#include <cuda.h>
#include <cuda_runtime.h>
#include "vhf.cuh"
#include "rys_roots_for_k.cu"
#include "create_tasks.cu"


__global__ static
void rys_ejk_ip2_type12_0000(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double f3x, f3y, f3z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        double dd_cache0 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    dd = dd_cache0;
                    Ix = 1;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    f1x = aj2 * hrr_0100x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    f1y = aj2 * hrr_0100y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_10z;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    f3x = ai2 * hrr_1100x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    f3y = ai2 * hrr_1100y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    f3z = ai2 * hrr_1100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double trr_01x = cpx * 1;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    f1x = al2 * hrr_0001x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    f1y = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_01z;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    double hrr_0011x = trr_02x - xlxk * trr_01x;
                    f3x = ak2 * hrr_0011x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    double hrr_0011y = trr_02y - ylyk * trr_01y;
                    f3y = ak2 * hrr_0011y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    double hrr_0011z = trr_02z - zlzk * trr_01z;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_0002x = hrr_0011x - xlxk * hrr_0001x;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    double hrr_0002y = hrr_0011y - ylyk * hrr_0001y;
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0002z = hrr_0011z - zlzk * hrr_0001z;
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1000(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double f3x, f3y, f3z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    dd = dd_cache0;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    f1x = aj2 * hrr_1100x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    f1y = aj2 * hrr_0100y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_20x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_10z;
                    f2x -= 1 * 1;
                    double trr_30x = c0x * trr_20x + 2*b10 * trr_10x;
                    double hrr_2100x = trr_30x - xjxi * trr_20x;
                    f3x = ai2 * hrr_2100x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    f3y = ai2 * hrr_1100y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    f3z = ai2 * hrr_1100z;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    f3x -= 1 * hrr_0100x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_30x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_1200x = hrr_2100x - xjxi * hrr_1100x;
                    f3x = aj2 * (aj2 * hrr_1200x - 1 * Ix);
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    f1x = al2 * hrr_1001x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    f1y = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_11x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_01z;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_01x = cpx * 1;
                    double trr_12x = cpx * trr_11x + 1*b01 * trr_10x + 1*b00 * trr_01x;
                    double hrr_1011x = trr_12x - xlxk * trr_11x;
                    f3x = ak2 * hrr_1011x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    double hrr_0011y = trr_02y - ylyk * trr_01y;
                    f3y = ak2 * hrr_0011y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    double hrr_0011z = trr_02z - zlzk * trr_01z;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_12x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_1002x = hrr_1011x - xlxk * hrr_1001x;
                    f3x = al2 * (al2 * hrr_1002x - 1 * Ix);
                    double hrr_0002y = hrr_0011y - ylyk * hrr_0001y;
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0002z = hrr_0011z - zlzk * hrr_0001z;
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache1;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_1100y;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_20y;
                    f2z = ai2 * trr_10z;
                    f2y -= 1 * 1;
                    f3x = ai2 * hrr_1100x;
                    double trr_30y = c0y * trr_20y + 2*b10 * trr_10y;
                    double hrr_2100y = trr_30y - yjyi * trr_20y;
                    f3y = ai2 * hrr_2100y;
                    f3z = ai2 * hrr_1100z;
                    f3y -= 1 * hrr_0100y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_30y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    double hrr_1200y = hrr_2100y - yjyi * hrr_1100y;
                    f3y = aj2 * (aj2 * hrr_1200y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    f1x = al2 * hrr_0001x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    f1y = al2 * hrr_1001y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_11y;
                    f2z = ak2 * trr_01z;
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    double hrr_0011x = trr_02x - xlxk * trr_01x;
                    f3x = ak2 * hrr_0011x;
                    double trr_12y = cpy * trr_11y + 1*b01 * trr_10y + 1*b00 * trr_01y;
                    double hrr_1011y = trr_12y - ylyk * trr_11y;
                    f3y = ak2 * hrr_1011y;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_12y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_0002x = hrr_0011x - xlxk * hrr_0001x;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    double hrr_1002y = hrr_1011y - ylyk * hrr_1001y;
                    f3y = al2 * (al2 * hrr_1002y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache2;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_1100z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_20z;
                    f2z -= 1 * wt;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_1100y;
                    double trr_30z = c0z * trr_20z + 2*b10 * trr_10z;
                    double hrr_2100z = trr_30z - zjzi * trr_20z;
                    f3z = ai2 * hrr_2100z;
                    f3z -= 1 * hrr_0100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_30z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_1200z = hrr_2100z - zjzi * hrr_1100z;
                    f3z = aj2 * (aj2 * hrr_1200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_0001y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    f1z = al2 * hrr_1001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_11z;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_0011y;
                    double trr_12z = cpz * trr_11z + 1*b01 * trr_10z + 1*b00 * trr_01z;
                    double hrr_1011z = trr_12z - zlzk * trr_11z;
                    f3z = ak2 * hrr_1011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_12z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_1002z = hrr_1011z - zlzk * hrr_1001z;
                    f3z = al2 * (al2 * hrr_1002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1010(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double f3x, f3y, f3z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        double dd_cache3 = 0.;
        double dd_cache4 = 0.;
        double dd_cache5 = 0.;
        double dd_cache6 = 0.;
        double dd_cache7 = 0.;
        double dd_cache8 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+1)]);
                dd_cache4 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+1)]);
                dd_cache5 += fac * (dm[(j0+0)*nao+(k0+1)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+1)]);
                dd_cache6 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+2)]);
                dd_cache7 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+2)]);
                dd_cache8 += fac * (dm[(j0+0)*nao+(k0+2)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+2)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache3 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache4 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache5 += fac * dm[(l0+0)*nao+(k0+1)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache6 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache7 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache8 += fac * dm[(l0+0)*nao+(k0+2)] * dm[(j0+0)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+1)]);
                dd_cache4 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+1)]);
                dd_cache5 += fac * (dm[(j0+0)*nao+(k0+1)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+1)] + dmb[(j0+0)*nao+(k0+1)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+1)]);
                dd_cache6 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+2)]);
                dd_cache7 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+2)]);
                dd_cache8 += fac * (dm[(j0+0)*nao+(k0+2)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+2)] + dmb[(j0+0)*nao+(k0+2)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+2)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache3 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache4 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache5 += fac * (dm[(l0+0)*nao+(k0+1)]+dmb[(l0+0)*nao+(k0+1)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache6 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache7 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache8 += fac * (dm[(l0+0)*nao+(k0+2)]+dmb[(l0+0)*nao+(k0+2)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    dd = dd_cache0;
                    Ix = trr_11x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    f1x = aj2 * hrr_1110x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    f1y = aj2 * hrr_0100y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_21x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_10z;
                    double trr_01x = cpx * 1;
                    f2x -= 1 * trr_01x;
                    double trr_30x = c0x * trr_20x + 2*b10 * trr_10x;
                    double trr_31x = cpx * trr_30x + 3*b00 * trr_20x;
                    double hrr_2110x = trr_31x - xjxi * trr_21x;
                    f3x = ai2 * hrr_2110x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    f3y = ai2 * hrr_1100y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    f3z = ai2 * hrr_1100z;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    f3x -= 1 * hrr_0110x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_31x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_1210x = hrr_2110x - xjxi * hrr_1110x;
                    f3x = aj2 * (aj2 * hrr_1210x - 1 * Ix);
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache1;
                    Ix = trr_01x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0110x;
                    f1y = aj2 * hrr_1100y;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_11x;
                    f2y = ai2 * trr_20y;
                    f2z = ai2 * trr_10z;
                    f2y -= 1 * 1;
                    f3x = ai2 * hrr_1110x;
                    double trr_30y = c0y * trr_20y + 2*b10 * trr_10y;
                    double hrr_2100y = trr_30y - yjyi * trr_20y;
                    f3y = ai2 * hrr_2100y;
                    f3z = ai2 * hrr_1100z;
                    f3y -= 1 * hrr_0100y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_21x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_30y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_0210x = hrr_1110x - xjxi * hrr_0110x;
                    f3x = aj2 * (aj2 * hrr_0210x - 1 * Ix);
                    double hrr_1200y = hrr_2100y - yjyi * hrr_1100y;
                    f3y = aj2 * (aj2 * hrr_1200y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache2;
                    Ix = trr_01x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0110x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_1100z;
                    f2x = ai2 * trr_11x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_20z;
                    f2z -= 1 * wt;
                    f3x = ai2 * hrr_1110x;
                    f3y = ai2 * hrr_1100y;
                    double trr_30z = c0z * trr_20z + 2*b10 * trr_10z;
                    double hrr_2100z = trr_30z - zjzi * trr_20z;
                    f3z = ai2 * hrr_2100z;
                    f3z -= 1 * hrr_0100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_21x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_30z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0210x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_1200z = hrr_2100z - zjzi * hrr_1100z;
                    f3z = aj2 * (aj2 * hrr_1200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = trr_01y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    f1x = aj2 * hrr_1100x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    f1y = aj2 * hrr_0110y;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_20x;
                    f2y = ai2 * trr_11y;
                    f2z = ai2 * trr_10z;
                    f2x -= 1 * 1;
                    double hrr_2100x = trr_30x - xjxi * trr_20x;
                    f3x = ai2 * hrr_2100x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    f3y = ai2 * hrr_1110y;
                    f3z = ai2 * hrr_1100z;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    f3x -= 1 * hrr_0100x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_30x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_21y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_1200x = hrr_2100x - xjxi * hrr_1100x;
                    f3x = aj2 * (aj2 * hrr_1200x - 1 * Ix);
                    double hrr_0210y = hrr_1110y - yjyi * hrr_0110y;
                    f3y = aj2 * (aj2 * hrr_0210y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = trr_11y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_1110y;
                    f1z = aj2 * hrr_0100z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_21y;
                    f2z = ai2 * trr_10z;
                    f2y -= 1 * trr_01y;
                    f3x = ai2 * hrr_1100x;
                    double trr_31y = cpy * trr_30y + 3*b00 * trr_20y;
                    double hrr_2110y = trr_31y - yjyi * trr_21y;
                    f3y = ai2 * hrr_2110y;
                    f3z = ai2 * hrr_1100z;
                    f3y -= 1 * hrr_0110y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_31y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    double hrr_1210y = hrr_2110y - yjyi * hrr_1110y;
                    f3y = aj2 * (aj2 * hrr_1210y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = trr_01y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_0110y;
                    f1z = aj2 * hrr_1100z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_11y;
                    f2z = ai2 * trr_20z;
                    f2z -= 1 * wt;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_1110y;
                    f3z = ai2 * hrr_2100z;
                    f3z -= 1 * hrr_0100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_21y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_30z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0210y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_1200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_1100x;
                    f1y = aj2 * hrr_0100y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    f1z = aj2 * hrr_0110z;
                    f2x = ai2 * trr_20x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_11z;
                    f2x -= 1 * 1;
                    f3x = ai2 * hrr_2100x;
                    f3y = ai2 * hrr_1100y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    f3z = ai2 * hrr_1110z;
                    f3x -= 1 * hrr_0100x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_30x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_21z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_1200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0210z = hrr_1110z - zjzi * hrr_0110z;
                    f3z = aj2 * (aj2 * hrr_0210z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_1100y;
                    f1z = aj2 * hrr_0110z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_20y;
                    f2z = ai2 * trr_11z;
                    f2y -= 1 * 1;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_2100y;
                    f3z = ai2 * hrr_1110z;
                    f3y -= 1 * hrr_0100y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_30y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_21z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_1200y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0210z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_11z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_1110z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_21z;
                    f2z -= 1 * trr_01z;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_1100y;
                    double trr_31z = cpz * trr_30z + 3*b00 * trr_20z;
                    double hrr_2110z = trr_31z - zjzi * trr_21z;
                    f3z = ai2 * hrr_2110z;
                    f3z -= 1 * hrr_0110z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_31z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_1210z = hrr_2110z - zjzi * hrr_1110z;
                    f3z = aj2 * (aj2 * hrr_1210z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    }
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b00 = .5 * rt_aa;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    dd = dd_cache0;
                    Ix = trr_11x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_01x = cpx * 1;
                    double trr_12x = cpx * trr_11x + 1*b01 * trr_10x + 1*b00 * trr_01x;
                    double hrr_1011x = trr_12x - xlxk * trr_11x;
                    f1x = al2 * hrr_1011x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    f1y = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_12x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_01z;
                    f2x -= 1 * trr_10x;
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    double trr_13x = cpx * trr_12x + 2*b01 * trr_11x + 1*b00 * trr_02x;
                    double hrr_1021x = trr_13x - xlxk * trr_12x;
                    f3x = ak2 * hrr_1021x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    double hrr_0011y = trr_02y - ylyk * trr_01y;
                    f3y = ak2 * hrr_0011y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    double hrr_0011z = trr_02z - zlzk * trr_01z;
                    f3z = ak2 * hrr_0011z;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    f3x -= 1 * hrr_1001x;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_13x - 3 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_1012x = hrr_1021x - xlxk * hrr_1011x;
                    f3x = al2 * (al2 * hrr_1012x - 1 * Ix);
                    double hrr_0002y = hrr_0011y - ylyk * hrr_0001y;
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0002z = hrr_0011z - zlzk * hrr_0001z;
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    dd = dd_cache1;
                    Ix = trr_01x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double hrr_0011x = trr_02x - xlxk * trr_01x;
                    f1x = al2 * hrr_0011x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    f1y = al2 * hrr_1001y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_02x;
                    f2y = ak2 * trr_11y;
                    f2z = ak2 * trr_01z;
                    f2x -= 1 * 1;
                    double trr_03x = cpx * trr_02x + 2*b01 * trr_01x;
                    double hrr_0021x = trr_03x - xlxk * trr_02x;
                    f3x = ak2 * hrr_0021x;
                    double trr_12y = cpy * trr_11y + 1*b01 * trr_10y + 1*b00 * trr_01y;
                    double hrr_1011y = trr_12y - ylyk * trr_11y;
                    f3y = ak2 * hrr_1011y;
                    f3z = ak2 * hrr_0011z;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    f3x -= 1 * hrr_0001x;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_03x - 3 * Ix);
                    f3y = ak2 * (ak2 * trr_12y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_0012x = hrr_0021x - xlxk * hrr_0011x;
                    f3x = al2 * (al2 * hrr_0012x - 1 * Ix);
                    double hrr_1002y = hrr_1011y - ylyk * hrr_1001y;
                    f3y = al2 * (al2 * hrr_1002y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    dd = dd_cache2;
                    Ix = trr_01x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0011x;
                    f1y = al2 * hrr_0001y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    f1z = al2 * hrr_1001z;
                    f2x = ak2 * trr_02x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_11z;
                    f2x -= 1 * 1;
                    f3x = ak2 * hrr_0021x;
                    f3y = ak2 * hrr_0011y;
                    double trr_12z = cpz * trr_11z + 1*b01 * trr_10z + 1*b00 * trr_01z;
                    double hrr_1011z = trr_12z - zlzk * trr_11z;
                    f3z = ak2 * hrr_1011z;
                    f3x -= 1 * hrr_0001x;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_03x - 3 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_12z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0012x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_1002z = hrr_1011z - zlzk * hrr_1001z;
                    f3z = al2 * (al2 * hrr_1002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = trr_01y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_1001x;
                    f1y = al2 * hrr_0011y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_11x;
                    f2y = ak2 * trr_02y;
                    f2z = ak2 * trr_01z;
                    f2y -= 1 * 1;
                    f3x = ak2 * hrr_1011x;
                    double trr_03y = cpy * trr_02y + 2*b01 * trr_01y;
                    double hrr_0021y = trr_03y - ylyk * trr_02y;
                    f3y = ak2 * hrr_0021y;
                    f3z = ak2 * hrr_0011z;
                    f3y -= 1 * hrr_0001y;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_12x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_03y - 3 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_1002x = hrr_1011x - xlxk * hrr_1001x;
                    f3x = al2 * (al2 * hrr_1002x - 1 * Ix);
                    double hrr_0012y = hrr_0021y - ylyk * hrr_0011y;
                    f3y = al2 * (al2 * hrr_0012y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = trr_11y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_1011y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_12y;
                    f2z = ak2 * trr_01z;
                    f2y -= 1 * trr_10y;
                    f3x = ak2 * hrr_0011x;
                    double trr_13y = cpy * trr_12y + 2*b01 * trr_11y + 1*b00 * trr_02y;
                    double hrr_1021y = trr_13y - ylyk * trr_12y;
                    f3y = ak2 * hrr_1021y;
                    f3z = ak2 * hrr_0011z;
                    f3y -= 1 * hrr_1001y;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_13y - 3 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_0002x = hrr_0011x - xlxk * hrr_0001x;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    double hrr_1012y = hrr_1021y - ylyk * hrr_1011y;
                    f3y = al2 * (al2 * hrr_1012y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = trr_01y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_0011y;
                    f1z = al2 * hrr_1001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_02y;
                    f2z = ak2 * trr_11z;
                    f2y -= 1 * 1;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_0021y;
                    f3z = ak2 * hrr_1011z;
                    f3y -= 1 * hrr_0001y;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_03y - 3 * Iy);
                    f3z = ak2 * (ak2 * trr_12z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0012y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_1002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_1001x;
                    f1y = al2 * hrr_0001y;
                    f1z = al2 * hrr_0011z;
                    f2x = ak2 * trr_11x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_02z;
                    f2z -= 1 * wt;
                    f3x = ak2 * hrr_1011x;
                    f3y = ak2 * hrr_0011y;
                    double trr_03z = cpz * trr_02z + 2*b01 * trr_01z;
                    double hrr_0021z = trr_03z - zlzk * trr_02z;
                    f3z = ak2 * hrr_0021z;
                    f3z -= 1 * hrr_0001z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_12x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_03z - 3 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_1002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0012z = hrr_0021z - zlzk * hrr_0011z;
                    f3z = al2 * (al2 * hrr_0012z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = trr_01z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_1001y;
                    f1z = al2 * hrr_0011z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_11y;
                    f2z = ak2 * trr_02z;
                    f2z -= 1 * wt;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_1011y;
                    f3z = ak2 * hrr_0021z;
                    f3z -= 1 * hrr_0001z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_12y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_03z - 3 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_1002y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0012z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = trr_11z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_0001y;
                    f1z = al2 * hrr_1011z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_12z;
                    f2z -= 1 * trr_10z;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_0011y;
                    double trr_13z = cpz * trr_12z + 2*b01 * trr_11z + 1*b00 * trr_02z;
                    double hrr_1021z = trr_13z - zlzk * trr_12z;
                    f3z = ak2 * hrr_1021z;
                    f3z -= 1 * hrr_1001z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_13z - 3 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_1012z = hrr_1021z - zlzk * hrr_1011z;
                    f3z = al2 * (al2 * hrr_1012z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1011(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 32;
    constexpr int gout_stride = 8;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 864 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 168 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (168+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[32] = ylyk;
            rlrk[64] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 3;
                int ij = n % 3;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 3;
                int ij = n % 3;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[32];
                double zlzk = rlrk[64];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[32] * al_akl;
                double zkl = rk[2] + rlrk[64] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[32] = ypq;
                    Rpq[64] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1728] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*64];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 8) {
                        if (n == 2) {
                            gx[3456] = rw[irys*64+32];
                        }
                        double *_gx = gx + n * 1728;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[32] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[64] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 2 * b10 * s0;
                        _gx[96] = s2;
                        double xlxk = rlrk[n*32];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[192] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[384] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        _gx[576] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        _gx[768] = s2;
                        s0 = _gx[32];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[224] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[192];
                        _gx[416] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 1 * b00 * _gx[384];
                        _gx[608] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 1 * b00 * _gx[576];
                        _gx[800] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[32];
                        _gx[256] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[224];
                        _gx[448] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 2 * b00 * _gx[416];
                        _gx[640] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 2 * b00 * _gx[608];
                        _gx[832] = s2;
                        s0 = _gx[96];
                        s1 = cpx * s0;
                        s1 += 3 * b00 * _gx[64];
                        _gx[288] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 3 * b00 * _gx[256];
                        _gx[480] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 3 * b00 * _gx[448];
                        _gx[672] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 3 * b00 * _gx[640];
                        _gx[864] = s2;
                        s1 = _gx[96];
                        s0 = _gx[64];
                        _gx[160] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[128] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[96] = s1 - xjxi * s0;
                        s1 = _gx[288];
                        s0 = _gx[256];
                        _gx[352] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[320] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[288] = s1 - xjxi * s0;
                        s1 = _gx[480];
                        s0 = _gx[448];
                        _gx[544] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[512] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[480] = s1 - xjxi * s0;
                        s1 = _gx[672];
                        s0 = _gx[640];
                        _gx[736] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[704] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[672] = s1 - xjxi * s0;
                        s1 = _gx[864];
                        s0 = _gx[832];
                        _gx[928] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[800];
                        _gx[896] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[768];
                        _gx[864] = s1 - xjxi * s0;
                        s1 = _gx[768];
                        s0 = _gx[576];
                        _gx[1152] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[768] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[576] = s1 - xlxk * s0;
                        s1 = _gx[1152];
                        s0 = _gx[960];
                        _gx[1536] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[768];
                        _gx[1344] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[1152] = s1 - xlxk * s0;
                        s1 = _gx[800];
                        s0 = _gx[608];
                        _gx[1184] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[992] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[800] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[608] = s1 - xlxk * s0;
                        s1 = _gx[1184];
                        s0 = _gx[992];
                        _gx[1568] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[800];
                        _gx[1376] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[1184] = s1 - xlxk * s0;
                        s1 = _gx[832];
                        s0 = _gx[640];
                        _gx[1216] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[448];
                        _gx[1024] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[256];
                        _gx[832] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[640] = s1 - xlxk * s0;
                        s1 = _gx[1216];
                        s0 = _gx[1024];
                        _gx[1600] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[832];
                        _gx[1408] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[640];
                        _gx[1216] = s1 - xlxk * s0;
                        s1 = _gx[864];
                        s0 = _gx[672];
                        _gx[1248] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[480];
                        _gx[1056] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[864] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[96];
                        _gx[672] = s1 - xlxk * s0;
                        s1 = _gx[1248];
                        s0 = _gx[1056];
                        _gx[1632] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[864];
                        _gx[1440] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[672];
                        _gx[1248] = s1 - xlxk * s0;
                        s1 = _gx[896];
                        s0 = _gx[704];
                        _gx[1280] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[512];
                        _gx[1088] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[704] = s1 - xlxk * s0;
                        s1 = _gx[1280];
                        s0 = _gx[1088];
                        _gx[1664] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[896];
                        _gx[1472] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[704];
                        _gx[1280] = s1 - xlxk * s0;
                        s1 = _gx[928];
                        s0 = _gx[736];
                        _gx[1312] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[544];
                        _gx[1120] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[928] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[160];
                        _gx[736] = s1 - xlxk * s0;
                        s1 = _gx[1312];
                        s0 = _gx[1120];
                        _gx[1696] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[928];
                        _gx[1504] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[736];
                        _gx[1312] = s1 - xlxk * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[800];
                    Iy = gx[1728];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[896];
                    f2x = ai2 * gx[832] - 1 * gx[768];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1376] - 1 * gx[224];
                    f2x = ak2 * gx[992] - 1 * gx[608];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[928] + gx[832] * xjxi) - 3 * gx[800]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[928] - gx[896] * xjxi) - 1 * gx[800]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1568] - gx[1376] * xlxk) - 3 * gx[800]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1568] + gx[992] * xlxk) - 3 * gx[800]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[928] - 1 * gx[864]) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1568] - 1 * gx[1184]) - 1 * (ak2 * gx[416] - 1 * gx[32])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[576];
                    Iy = gx[1728];
                    Iz = gx[3680];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672];
                    f2x = ai2 * gx[608];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3776];
                    f2z = ai2 * gx[3712] - 1 * gx[3648];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152] - 1 * gx[0];
                    f2x = ak2 * gx[768];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4256];
                    f2z = ak2 * gx[3872] - 1 * gx[3488];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[640] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[704] - gx[672] * xjxi) - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1344] - gx[1152] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3808] + gx[3712] * zjzi) - 3 * gx[3680]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3808] - gx[3776] * zjzi) - 1 * gx[3680]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4832] - 1 * gx[3680]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4448] + gx[3872] * zlzk) - 3 * gx[3680]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[704] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1344] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4448] - 1 * gx[4064]) * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[0];
                    Iy = gx[2336];
                    Iz = gx[3648];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2432];
                    f2y = ai2 * gx[2368] - 1 * gx[2304];
                    f1z = aj2 * gx[3744];
                    f2z = ai2 * gx[3680];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2912] - 1 * gx[1760];
                    f2y = ak2 * gx[2528];
                    f1z = al2 * gx[4224];
                    f2z = ak2 * gx[3840] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2464] + gx[2368] * yjyi) - 3 * gx[2336]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2464] - gx[2432] * yjyi) - 1 * gx[2336]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3104] - gx[2912] * ylyk) - 3 * gx[2336]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2720] - 1 * gx[2336]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3712] - 1 * gx[3648]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3776] - gx[3744] * zjzi) - 1 * gx[3648]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4800] - 1 * gx[3648]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4416] + gx[3840] * zlzk) - 3 * gx[3648]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2464] - 1 * gx[2400]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[3104] - 1 * ak2 * gx[1952]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3776] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[32];
                    Iy = gx[1728];
                    Iz = gx[4224];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[4320];
                    f2z = ai2 * gx[4256];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[608];
                    f2x = ak2 * gx[224];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4800] - 1 * gx[3648];
                    f2z = ak2 * gx[4416] - 1 * gx[4032];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[160] - gx[128] * xjxi) - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1184] - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[416] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4288] - 1 * gx[4224]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4352] - gx[4320] * zjzi) - 1 * gx[4224]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4992] - gx[4800] * zlzk) - 3 * gx[4224]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4992] + gx[4416] * zlzk) - 3 * gx[4224]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[800] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * ai2 * gx[4352] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[4992] - 1 * gx[4608]) - 1 * (ak2 * gx[3840] - 1 * gx[3456])) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[32];
                    Ix = gx[768];
                    Iy = gx[1760];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[864];
                    f2x = ai2 * gx[800];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1344] - 1 * gx[192];
                    f2x = ak2 * gx[960] - 1 * gx[576];
                    f1y = al2 * gx[2336];
                    f2y = ak2 * gx[1952];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[832] - 1 * gx[768]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[896] - gx[864] * xjxi) - 1 * gx[768]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1536] - gx[1344] * xlxk) - 3 * gx[768]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1536] + gx[960] * xlxk) - 3 * gx[768]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1888] - gx[1856] * yjyi) - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2912] - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2144] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[896] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1536] - 1 * gx[1152]) - 1 * (ak2 * gx[384] - 1 * gx[0])) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2528] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[288];
                    Ix = gx[224];
                    Iy = gx[2304];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[320];
                    f2x = ai2 * gx[256] - 1 * gx[192];
                    f1y = aj2 * gx[2400];
                    f2y = ai2 * gx[2336];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[800];
                    f2x = ak2 * gx[416] - 1 * gx[32];
                    f1y = al2 * gx[2880] - 1 * gx[1728];
                    f2y = ak2 * gx[2496];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[352] + gx[256] * xjxi) - 3 * gx[224]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[352] - gx[320] * xjxi) - 1 * gx[224]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1376] - 1 * gx[224]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[992] + gx[416] * xlxk) - 3 * gx[224]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2368] - 1 * gx[2304]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2432] - gx[2400] * yjyi) - 1 * gx[2304]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3072] - gx[2880] * ylyk) - 3 * gx[2304]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[992] - 1 * gx[608]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[2432] * prod_xz;
                    v2yy += (al2 * ak2 * gx[3072] - 1 * ak2 * gx[1920]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[544];
                    Ix = gx[0];
                    Iy = gx[2304];
                    Iz = gx[3680];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2400];
                    f2y = ai2 * gx[2336];
                    f1z = aj2 * gx[3776];
                    f2z = ai2 * gx[3712] - 1 * gx[3648];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2880] - 1 * gx[1728];
                    f2y = ak2 * gx[2496];
                    f1z = al2 * gx[4256];
                    f2z = ak2 * gx[3872] - 1 * gx[3488];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2368] - 1 * gx[2304]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2432] - gx[2400] * yjyi) - 1 * gx[2304]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3072] - gx[2880] * ylyk) - 3 * gx[2304]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3808] + gx[3712] * zjzi) - 3 * gx[3680]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3808] - gx[3776] * zjzi) - 1 * gx[3680]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4832] - 1 * gx[3680]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4448] + gx[3872] * zlzk) - 3 * gx[3680]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2432] * prod_xz;
                    v2yy += (al2 * ak2 * gx[3072] - 1 * ak2 * gx[1920]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4448] - 1 * gx[4064]) * prod_xy;
                    dd = dd_cache[800];
                    Ix = gx[0];
                    Iy = gx[1760];
                    Iz = gx[4224];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[4320];
                    f2z = ai2 * gx[4256];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2336];
                    f2y = ak2 * gx[1952];
                    f1z = al2 * gx[4800] - 1 * gx[3648];
                    f2z = ak2 * gx[4416] - 1 * gx[4032];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1888] - gx[1856] * yjyi) - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2912] - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2144] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4288] - 1 * gx[4224]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4352] - gx[4320] * zjzi) - 1 * gx[4224]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4992] - gx[4800] * zlzk) - 3 * gx[4224]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4992] + gx[4416] * zlzk) - 3 * gx[4224]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2528] * prod_xz;
                    v1zz += aj2 * ai2 * gx[4352] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[4992] - 1 * gx[4608]) - 1 * (ak2 * gx[3840] - 1 * gx[3456])) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[64];
                    Ix = gx[768];
                    Iy = gx[1728];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[864];
                    f2x = ai2 * gx[800];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1344] - 1 * gx[192];
                    f2x = ak2 * gx[960] - 1 * gx[576];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4064];
                    f2z = ak2 * gx[3680];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[832] - 1 * gx[768]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[896] - gx[864] * xjxi) - 1 * gx[768]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1536] - gx[1344] * xlxk) - 3 * gx[768]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1536] + gx[960] * xlxk) - 3 * gx[768]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3616] - gx[3584] * zjzi) - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4640] - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3872] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[896] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1536] - 1 * gx[1152]) - 1 * (ak2 * gx[384] - 1 * gx[0])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4256] * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[192];
                    Iy = gx[2336];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[288];
                    f2x = ai2 * gx[224];
                    f1y = aj2 * gx[2432];
                    f2y = ai2 * gx[2368] - 1 * gx[2304];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[768];
                    f2x = ak2 * gx[384] - 1 * gx[0];
                    f1y = al2 * gx[2912] - 1 * gx[1760];
                    f2y = ak2 * gx[2528];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[256] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[320] - gx[288] * xjxi) - 1 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1344] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[960] + gx[384] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2464] + gx[2368] * yjyi) - 3 * gx[2336]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2464] - gx[2432] * yjyi) - 1 * gx[2336]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3104] - gx[2912] * ylyk) - 3 * gx[2336]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2720] - 1 * gx[2336]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[320] * prod_yz;
                    v2xx += al2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2464] - 1 * gx[2400]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[3104] - 1 * ak2 * gx[1952]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[224];
                    Iy = gx[1728];
                    Iz = gx[4032];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[320];
                    f2x = ai2 * gx[256] - 1 * gx[192];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[4128];
                    f2z = ai2 * gx[4064];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[800];
                    f2x = ak2 * gx[416] - 1 * gx[32];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4608] - 1 * gx[3456];
                    f2z = ak2 * gx[4224];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[352] + gx[256] * xjxi) - 3 * gx[224]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[352] - gx[320] * xjxi) - 1 * gx[224]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1376] - 1 * gx[224]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[992] + gx[416] * xlxk) - 3 * gx[224]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4096] - 1 * gx[4032]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4160] - gx[4128] * zjzi) - 1 * gx[4032]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4800] - gx[4608] * zlzk) - 3 * gx[4032]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[992] - 1 * gx[608]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * ai2 * gx[4160] * prod_xy;
                    v2zz += (al2 * ak2 * gx[4800] - 1 * ak2 * gx[3648]) * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[4256];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[4352];
                    f2z = ai2 * gx[4288] - 1 * gx[4224];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4832] - 1 * gx[3680];
                    f2z = ak2 * gx[4448] - 1 * gx[4064];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[4384] + gx[4288] * zjzi) - 3 * gx[4256]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4384] - gx[4352] * zjzi) - 1 * gx[4256]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[5024] - gx[4832] * zlzk) - 3 * gx[4256]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[5024] + gx[4448] * zlzk) - 3 * gx[4256]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[4384] - 1 * gx[4320]) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[5024] - 1 * gx[4640]) - 1 * (ak2 * gx[3872] - 1 * gx[3488])) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[96];
                    Ix = gx[608];
                    Iy = gx[1920];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[704];
                    f2x = ai2 * gx[640] - 1 * gx[576];
                    f1y = aj2 * gx[2016];
                    f2y = ai2 * gx[1952];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1184] - 1 * gx[32];
                    f2x = ak2 * gx[800];
                    f1y = al2 * gx[2496];
                    f2y = ak2 * gx[2112] - 1 * gx[1728];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[736] + gx[640] * xjxi) - 3 * gx[608]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[736] - gx[704] * xjxi) - 1 * gx[608]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1376] - gx[1184] * xlxk) - 3 * gx[608]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[992] - 1 * gx[608]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1984] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2048] - gx[2016] * yjyi) - 1 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3072] - 1 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2688] + gx[2112] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[736] - 1 * gx[672]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1376] - 1 * ak2 * gx[224]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[2048] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[352];
                    Ix = gx[192];
                    Iy = gx[2304];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[288];
                    f2x = ai2 * gx[224];
                    f1y = aj2 * gx[2400];
                    f2y = ai2 * gx[2336];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[768];
                    f2x = ak2 * gx[384] - 1 * gx[0];
                    f1y = al2 * gx[2880] - 1 * gx[1728];
                    f2y = ak2 * gx[2496];
                    f1z = al2 * gx[4064];
                    f2z = ak2 * gx[3680];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[256] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[320] - gx[288] * xjxi) - 1 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1344] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[960] + gx[384] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2368] - 1 * gx[2304]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2432] - gx[2400] * yjyi) - 1 * gx[2304]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3072] - gx[2880] * ylyk) - 3 * gx[2304]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3616] - gx[3584] * zjzi) - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4640] - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3872] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[320] * prod_yz;
                    v2xx += al2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[2432] * prod_xz;
                    v2yy += (al2 * ak2 * gx[3072] - 1 * ak2 * gx[1920]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4256] * prod_xy;
                    dd = dd_cache[608];
                    Ix = gx[192];
                    Iy = gx[1760];
                    Iz = gx[4032];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[288];
                    f2x = ai2 * gx[224];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[4128];
                    f2z = ai2 * gx[4064];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[768];
                    f2x = ak2 * gx[384] - 1 * gx[0];
                    f1y = al2 * gx[2336];
                    f2y = ak2 * gx[1952];
                    f1z = al2 * gx[4608] - 1 * gx[3456];
                    f2z = ak2 * gx[4224];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[256] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[320] - gx[288] * xjxi) - 1 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1344] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[960] + gx[384] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1888] - gx[1856] * yjyi) - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2912] - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2144] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4096] - 1 * gx[4032]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4160] - gx[4128] * zjzi) - 1 * gx[4032]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4800] - gx[4608] * zlzk) - 3 * gx[4032]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[320] * prod_yz;
                    v2xx += al2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2528] * prod_xz;
                    v1zz += aj2 * ai2 * gx[4160] * prod_xy;
                    v2zz += (al2 * ak2 * gx[4800] - 1 * ak2 * gx[3648]) * prod_xy;
                    break;
                    case 4:
                    dd = dd_cache[128];
                    Ix = gx[576];
                    Iy = gx[1952];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672];
                    f2x = ai2 * gx[608];
                    f1y = aj2 * gx[2048];
                    f2y = ai2 * gx[1984] - 1 * gx[1920];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152] - 1 * gx[0];
                    f2x = ak2 * gx[768];
                    f1y = al2 * gx[2528];
                    f2y = ak2 * gx[2144] - 1 * gx[1760];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[640] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[704] - gx[672] * xjxi) - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1344] - gx[1152] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2080] + gx[1984] * yjyi) - 3 * gx[1952]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2080] - gx[2048] * yjyi) - 1 * gx[1952]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3104] - 1 * gx[1952]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2720] + gx[2144] * ylyk) - 3 * gx[1952]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[704] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1344] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2720] - 1 * gx[2336]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[32];
                    Iy = gx[2496];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[2592];
                    f2y = ai2 * gx[2528];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[608];
                    f2x = ak2 * gx[224];
                    f1y = al2 * gx[3072] - 1 * gx[1920];
                    f2y = ak2 * gx[2688] - 1 * gx[2304];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[160] - gx[128] * xjxi) - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1184] - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[416] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2560] - 1 * gx[2496]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2624] - gx[2592] * yjyi) - 1 * gx[2496]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3264] - gx[3072] * ylyk) - 3 * gx[2496]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3264] + gx[2688] * ylyk) - 3 * gx[2496]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[800] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2624] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[3264] - 1 * gx[2880]) - 1 * (ak2 * gx[2112] - 1 * gx[1728])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[192];
                    Iy = gx[1728];
                    Iz = gx[4064];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[288];
                    f2x = ai2 * gx[224];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[4160];
                    f2z = ai2 * gx[4096] - 1 * gx[4032];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[768];
                    f2x = ak2 * gx[384] - 1 * gx[0];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4640] - 1 * gx[3488];
                    f2z = ak2 * gx[4256];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[256] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[320] - gx[288] * xjxi) - 1 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1344] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[960] + gx[384] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[4192] + gx[4096] * zjzi) - 3 * gx[4064]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4192] - gx[4160] * zjzi) - 1 * gx[4064]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4832] - gx[4640] * zlzk) - 3 * gx[4064]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4448] - 1 * gx[4064]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[320] * prod_yz;
                    v2xx += al2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[4192] - 1 * gx[4128]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[4832] - 1 * ak2 * gx[3680]) * prod_xy;
                    break;
                    case 5:
                    dd = dd_cache[160];
                    Ix = gx[576];
                    Iy = gx[1920];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672];
                    f2x = ai2 * gx[608];
                    f1y = aj2 * gx[2016];
                    f2y = ai2 * gx[1952];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152] - 1 * gx[0];
                    f2x = ak2 * gx[768];
                    f1y = al2 * gx[2496];
                    f2y = ak2 * gx[2112] - 1 * gx[1728];
                    f1z = al2 * gx[4064];
                    f2z = ak2 * gx[3680];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[640] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[704] - gx[672] * xjxi) - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1344] - gx[1152] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1984] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2048] - gx[2016] * yjyi) - 1 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3072] - 1 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2688] + gx[2112] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3616] - gx[3584] * zjzi) - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4640] - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3872] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[704] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1344] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[2048] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4256] * prod_xy;
                    dd = dd_cache[416];
                    Ix = gx[0];
                    Iy = gx[2528];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2624];
                    f2y = ai2 * gx[2560] - 1 * gx[2496];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[3104] - 1 * gx[1952];
                    f2y = ak2 * gx[2720] - 1 * gx[2336];
                    f1z = al2 * gx[4032];
                    f2z = ak2 * gx[3648];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2656] + gx[2560] * yjyi) - 3 * gx[2528]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2656] - gx[2624] * yjyi) - 1 * gx[2528]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3296] - gx[3104] * ylyk) - 3 * gx[2528]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3296] + gx[2720] * ylyk) - 3 * gx[2528]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3584] - gx[3552] * zjzi) - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4608] - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3840] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2656] - 1 * gx[2592]) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[3296] - 1 * gx[2912]) - 1 * (ak2 * gx[2144] - 1 * gx[1760])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4224] * prod_xy;
                    dd = dd_cache[672];
                    Ix = gx[32];
                    Iy = gx[1920];
                    Iz = gx[4032];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[2016];
                    f2y = ai2 * gx[1952];
                    f1z = aj2 * gx[4128];
                    f2z = ai2 * gx[4064];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[608];
                    f2x = ak2 * gx[224];
                    f1y = al2 * gx[2496];
                    f2y = ak2 * gx[2112] - 1 * gx[1728];
                    f1z = al2 * gx[4608] - 1 * gx[3456];
                    f2z = ak2 * gx[4224];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[160] - gx[128] * xjxi) - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1184] - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[416] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1984] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2048] - gx[2016] * yjyi) - 1 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3072] - 1 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2688] + gx[2112] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4096] - 1 * gx[4032]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4160] - gx[4128] * zjzi) - 1 * gx[4032]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4800] - gx[4608] * zlzk) - 3 * gx[4032]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[800] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2048] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[4160] * prod_xy;
                    v2zz += (al2 * ak2 * gx[4800] - 1 * ak2 * gx[3648]) * prod_xy;
                    break;
                    case 6:
                    dd = dd_cache[192];
                    Ix = gx[608];
                    Iy = gx[1728];
                    Iz = gx[3648];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[704];
                    f2x = ai2 * gx[640] - 1 * gx[576];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3744];
                    f2z = ai2 * gx[3680];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1184] - 1 * gx[32];
                    f2x = ak2 * gx[800];
                    f1y = al2 * gx[2304];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[4224];
                    f2z = ak2 * gx[3840] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[736] + gx[640] * xjxi) - 3 * gx[608]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[736] - gx[704] * xjxi) - 1 * gx[608]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1376] - gx[1184] * xlxk) - 3 * gx[608]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[992] - 1 * gx[608]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1824] * yjyi) - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2880] - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2112] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3712] - 1 * gx[3648]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3776] - gx[3744] * zjzi) - 1 * gx[3648]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4800] - 1 * gx[3648]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4416] + gx[3840] * zlzk) - 3 * gx[3648]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[736] - 1 * gx[672]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1376] - 1 * ak2 * gx[224]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2496] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3776] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[0];
                    Iy = gx[2496];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2592];
                    f2y = ai2 * gx[2528];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[3072] - 1 * gx[1920];
                    f2y = ak2 * gx[2688] - 1 * gx[2304];
                    f1z = al2 * gx[4064];
                    f2z = ak2 * gx[3680];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2560] - 1 * gx[2496]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2624] - gx[2592] * yjyi) - 1 * gx[2496]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3264] - gx[3072] * ylyk) - 3 * gx[2496]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3264] + gx[2688] * ylyk) - 3 * gx[2496]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3616] - gx[3584] * zjzi) - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4640] - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3872] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2624] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[3264] - 1 * gx[2880]) - 1 * (ak2 * gx[2112] - 1 * gx[1728])) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4256] * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[0];
                    Iy = gx[1952];
                    Iz = gx[4032];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2048];
                    f2y = ai2 * gx[1984] - 1 * gx[1920];
                    f1z = aj2 * gx[4128];
                    f2z = ai2 * gx[4064];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2528];
                    f2y = ak2 * gx[2144] - 1 * gx[1760];
                    f1z = al2 * gx[4608] - 1 * gx[3456];
                    f2z = ak2 * gx[4224];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2080] + gx[1984] * yjyi) - 3 * gx[1952]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2080] - gx[2048] * yjyi) - 1 * gx[1952]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3104] - 1 * gx[1952]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2720] + gx[2144] * ylyk) - 3 * gx[1952]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[4096] - 1 * gx[4032]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4160] - gx[4128] * zjzi) - 1 * gx[4032]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4800] - gx[4608] * zlzk) - 3 * gx[4032]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2720] - 1 * gx[2336]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[4160] * prod_xy;
                    v2zz += (al2 * ak2 * gx[4800] - 1 * ak2 * gx[3648]) * prod_xy;
                    break;
                    case 7:
                    dd = dd_cache[224];
                    Ix = gx[576];
                    Iy = gx[1760];
                    Iz = gx[3648];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672];
                    f2x = ai2 * gx[608];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3744];
                    f2z = ai2 * gx[3680];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152] - 1 * gx[0];
                    f2x = ak2 * gx[768];
                    f1y = al2 * gx[2336];
                    f2y = ak2 * gx[1952];
                    f1z = al2 * gx[4224];
                    f2z = ak2 * gx[3840] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[640] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[704] - gx[672] * xjxi) - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1344] - gx[1152] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[960] - 1 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1888] - gx[1856] * yjyi) - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2912] - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2144] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3712] - 1 * gx[3648]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3776] - gx[3744] * zjzi) - 1 * gx[3648]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4800] - 1 * gx[3648]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4416] + gx[3840] * zlzk) - 3 * gx[3648]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[704] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1344] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2528] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3776] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    dd = dd_cache[480];
                    Ix = gx[32];
                    Iy = gx[2304];
                    Iz = gx[3648];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[2400];
                    f2y = ai2 * gx[2336];
                    f1z = aj2 * gx[3744];
                    f2z = ai2 * gx[3680];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[608];
                    f2x = ak2 * gx[224];
                    f1y = al2 * gx[2880] - 1 * gx[1728];
                    f2y = ak2 * gx[2496];
                    f1z = al2 * gx[4224];
                    f2z = ak2 * gx[3840] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[160] - gx[128] * xjxi) - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1184] - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[416] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2368] - 1 * gx[2304]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2432] - gx[2400] * yjyi) - 1 * gx[2304]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3072] - gx[2880] * ylyk) - 3 * gx[2304]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3712] - 1 * gx[3648]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3776] - gx[3744] * zjzi) - 1 * gx[3648]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[4800] - 1 * gx[3648]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4416] + gx[3840] * zlzk) - 3 * gx[3648]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[800] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2432] * prod_xz;
                    v2yy += (al2 * ak2 * gx[3072] - 1 * ak2 * gx[1920]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3776] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4416] - 1 * gx[4032]) * prod_xy;
                    dd = dd_cache[736];
                    Ix = gx[0];
                    Iy = gx[1920];
                    Iz = gx[4064];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2016];
                    f2y = ai2 * gx[1952];
                    f1z = aj2 * gx[4160];
                    f2z = ai2 * gx[4096] - 1 * gx[4032];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2496];
                    f2y = ak2 * gx[2112] - 1 * gx[1728];
                    f1z = al2 * gx[4640] - 1 * gx[3488];
                    f2z = ak2 * gx[4256];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[96] * xjxi) - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1152] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[384] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1984] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2048] - gx[2016] * yjyi) - 1 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[3072] - 1 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2688] + gx[2112] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[4192] + gx[4096] * zjzi) - 3 * gx[4064]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4192] - gx[4160] * zjzi) - 1 * gx[4064]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4832] - gx[4640] * zlzk) - 3 * gx[4064]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4448] - 1 * gx[4064]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[768] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2048] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2688] - 1 * gx[2304]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[4192] - 1 * gx[4128]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[4832] - 1 * ak2 * gx[3680]) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1100(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 256;
    constexpr int gout_stride = 1;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rw = shared_memory + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double f3x, f3y, f3z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        double dd_cache0 = 0.;
        double dd_cache1 = 0.;
        double dd_cache2 = 0.;
        double dd_cache3 = 0.;
        double dd_cache4 = 0.;
        double dd_cache5 = 0.;
        double dd_cache6 = 0.;
        double dd_cache7 = 0.;
        double dd_cache8 = 0.;
        if (jk.n_dm == 1) {
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache4 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache5 += fac * (dm[(j0+1)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
                dd_cache6 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+0)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+0)*nao+(k0+0)]);
                dd_cache7 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+1)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+1)*nao+(k0+0)]);
                dd_cache8 += fac * (dm[(j0+2)*nao+(k0+0)] * dm[(i0+2)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)] * dm[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+0)];
                dd_cache1 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+1)];
                dd_cache2 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+0)*nao+(i0+2)];
                dd_cache3 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+0)];
                dd_cache4 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+1)];
                dd_cache5 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+1)*nao+(i0+2)];
                dd_cache6 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+0)];
                dd_cache7 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+1)];
                dd_cache8 += fac * dm[(l0+0)*nao+(k0+0)] * dm[(j0+2)*nao+(i0+2)];
            }
        } else {
            double *dmb = dm + nao * nao;
            if (jk.k_factor != 0) {
                double fac = fac_sym * jk.k_factor;
                dd_cache0 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache1 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache2 += fac * (dm[(j0+0)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+0)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+0)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+0)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache3 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache4 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache5 += fac * (dm[(j0+1)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+1)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+1)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+1)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
                dd_cache6 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+0)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+0)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+0)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+0)*nao+(k0+0)]);
                dd_cache7 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+1)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+1)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+1)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+1)*nao+(k0+0)]);
                dd_cache8 += fac * (dm[(j0+2)*nao+(k0+0)]*dm[(i0+2)*nao+(l0+0)] + dm[(j0+2)*nao+(l0+0)]*dm[(i0+2)*nao+(k0+0)] + dmb[(j0+2)*nao+(k0+0)]*dmb[(i0+2)*nao+(l0+0)] + dmb[(j0+2)*nao+(l0+0)]*dmb[(i0+2)*nao+(k0+0)]);
            }
            if (jk.j_factor != 0) {
                double fac = fac_sym * jk.j_factor;
                dd_cache0 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+0)]+dmb[(j0+0)*nao+(i0+0)]);
                dd_cache1 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+1)]+dmb[(j0+0)*nao+(i0+1)]);
                dd_cache2 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+0)*nao+(i0+2)]+dmb[(j0+0)*nao+(i0+2)]);
                dd_cache3 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+0)]+dmb[(j0+1)*nao+(i0+0)]);
                dd_cache4 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+1)]+dmb[(j0+1)*nao+(i0+1)]);
                dd_cache5 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+1)*nao+(i0+2)]+dmb[(j0+1)*nao+(i0+2)]);
                dd_cache6 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+0)]+dmb[(j0+2)*nao+(i0+0)]);
                dd_cache7 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+1)]+dmb[(j0+2)*nao+(i0+1)]);
                dd_cache8 += fac * (dm[(l0+0)*nao+(k0+0)]+dmb[(l0+0)*nao+(k0+0)]) * (dm[(j0+2)*nao+(i0+2)]+dmb[(j0+2)*nao+(i0+2)]);
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
            double ckcl = ck[kp] * cl[lp] * Kcd;
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double cicj = cicj_cache[ijp];
                double fac = cicj * ckcl / (aij*akl*sqrt(aij+akl));
                double xpa = rjri[0] * aj_aij;
                double ypa = rjri[1] * aj_aij;
                double zpa = rjri[2] * aj_aij;
                double xij = ri[0] + xpa;
                double yij = ri[1] + ypa;
                double zij = ri[2] + zpa;
                double xqc = xlxk * al_akl;
                double yqc = ylyk * al_akl;
                double zqc = zlzk * al_akl;
                double xkl = rk[0] + xqc;
                double ykl = rk[1] + yqc;
                double zkl = rk[2] + zqc;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double rr = xpq*xpq + ypq*ypq + zpq*zpq;
                double theta = aij * akl / (aij + akl);
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                if (task_id >= ntasks) {
                    continue;
                }
                for (int irys = 0; irys < nroots; ++irys) {
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    dd = dd_cache0;
                    Ix = hrr_1100x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double trr_30x = c0x * trr_20x + 2*b10 * trr_10x;
                    double hrr_2100x = trr_30x - xjxi * trr_20x;
                    double hrr_1200x = hrr_2100x - xjxi * hrr_1100x;
                    f1x = aj2 * hrr_1200x;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    f1y = aj2 * hrr_0100y;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    f1z = aj2 * hrr_0100z;
                    f1x -= 1 * trr_10x;
                    f2x = ai2 * hrr_2100x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_10z;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    f2x -= 1 * hrr_0100x;
                    double trr_40x = c0x * trr_30x + 3*b10 * trr_20x;
                    double hrr_3100x = trr_40x - xjxi * trr_30x;
                    double hrr_2200x = hrr_3100x - xjxi * hrr_2100x;
                    f3x = ai2 * hrr_2200x;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    f3y = ai2 * hrr_1100y;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    f3z = ai2 * hrr_1100z;
                    double hrr_0200x = hrr_1100x - xjxi * hrr_0100x;
                    f3x -= 1 * hrr_0200x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3x -= 1 * (ai2 * trr_20x - 1 * 1);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * hrr_3100x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_1300x = hrr_2200x - xjxi * hrr_1200x;
                    f3x = aj2 * (aj2 * hrr_1300x - 3 * Ix);
                    double hrr_0200y = hrr_1100y - yjyi * hrr_0100y;
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0200z = hrr_1100z - zjzi * hrr_0100z;
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache1;
                    Ix = hrr_0100x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0200x;
                    f1y = aj2 * hrr_1100y;
                    f1z = aj2 * hrr_0100z;
                    f1x -= 1 * 1;
                    f2x = ai2 * hrr_1100x;
                    f2y = ai2 * trr_20y;
                    f2z = ai2 * trr_10z;
                    f2y -= 1 * 1;
                    f3x = ai2 * hrr_1200x;
                    double trr_30y = c0y * trr_20y + 2*b10 * trr_10y;
                    double hrr_2100y = trr_30y - yjyi * trr_20y;
                    f3y = ai2 * hrr_2100y;
                    f3z = ai2 * hrr_1100z;
                    f3y -= 1 * hrr_0100y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3x -= 1 * (ai2 * trr_10x);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * hrr_2100x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_30y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    double hrr_0300x = hrr_1200x - xjxi * hrr_0200x;
                    f3x = aj2 * (aj2 * hrr_0300x - 3 * Ix);
                    double hrr_1200y = hrr_2100y - yjyi * hrr_1100y;
                    f3y = aj2 * (aj2 * hrr_1200y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache2;
                    Ix = hrr_0100x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0200x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_1100z;
                    f1x -= 1 * 1;
                    f2x = ai2 * hrr_1100x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * trr_20z;
                    f2z -= 1 * wt;
                    f3x = ai2 * hrr_1200x;
                    f3y = ai2 * hrr_1100y;
                    double trr_30z = c0z * trr_20z + 2*b10 * trr_10z;
                    double hrr_2100z = trr_30z - zjzi * trr_20z;
                    f3z = ai2 * hrr_2100z;
                    f3z -= 1 * hrr_0100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3x -= 1 * (ai2 * trr_10x);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * hrr_2100x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_30z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0300x - 3 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_1200z = hrr_2100z - zjzi * hrr_1100z;
                    f3z = aj2 * (aj2 * hrr_1200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = hrr_0100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_1100x;
                    f1y = aj2 * hrr_0200y;
                    f1z = aj2 * hrr_0100z;
                    f1y -= 1 * 1;
                    f2x = ai2 * trr_20x;
                    f2y = ai2 * hrr_1100y;
                    f2z = ai2 * trr_10z;
                    f2x -= 1 * 1;
                    f3x = ai2 * hrr_2100x;
                    f3y = ai2 * hrr_1200y;
                    f3z = ai2 * hrr_1100z;
                    f3x -= 1 * hrr_0100x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3y -= 1 * (ai2 * trr_10y);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_30x - 3 * Ix);
                    f3y = ai2 * (ai2 * hrr_2100y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_1200x - 1 * Ix);
                    double hrr_0300y = hrr_1200y - yjyi * hrr_0200y;
                    f3y = aj2 * (aj2 * hrr_0300y - 3 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = hrr_1100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_1200y;
                    f1z = aj2 * hrr_0100z;
                    f1y -= 1 * trr_10y;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * hrr_2100y;
                    f2z = ai2 * trr_10z;
                    f2y -= 1 * hrr_0100y;
                    f3x = ai2 * hrr_1100x;
                    double trr_40y = c0y * trr_30y + 3*b10 * trr_20y;
                    double hrr_3100y = trr_40y - yjyi * trr_30y;
                    double hrr_2200y = hrr_3100y - yjyi * hrr_2100y;
                    f3y = ai2 * hrr_2200y;
                    f3z = ai2 * hrr_1100z;
                    f3y -= 1 * hrr_0200y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3y -= 1 * (ai2 * trr_20y - 1 * 1);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * hrr_3100y - 3 * Iy);
                    f3z = ai2 * (ai2 * trr_20z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    double hrr_1300y = hrr_2200y - yjyi * hrr_1200y;
                    f3y = aj2 * (aj2 * hrr_1300y - 3 * Iy);
                    f3z = aj2 * (aj2 * hrr_0200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = hrr_0100y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_0200y;
                    f1z = aj2 * hrr_1100z;
                    f1y -= 1 * 1;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * hrr_1100y;
                    f2z = ai2 * trr_20z;
                    f2z -= 1 * wt;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_1200y;
                    f3z = ai2 * hrr_2100z;
                    f3z -= 1 * hrr_0100z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3y -= 1 * (ai2 * trr_10y);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * hrr_2100y - 1 * Iy);
                    f3z = ai2 * (ai2 * trr_30z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0300y - 3 * Iy);
                    f3z = aj2 * (aj2 * hrr_1200z - 1 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_1100x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_0200z;
                    f1z -= 1 * wt;
                    f2x = ai2 * trr_20x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * hrr_1100z;
                    f2x -= 1 * 1;
                    f3x = ai2 * hrr_2100x;
                    f3y = ai2 * hrr_1100y;
                    f3z = ai2 * hrr_1200z;
                    f3x -= 1 * hrr_0100x;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3z -= 1 * (ai2 * trr_10z);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_30x - 3 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * hrr_2100z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_1200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_0300z = hrr_1200z - zjzi * hrr_0200z;
                    f3z = aj2 * (aj2 * hrr_0300z - 3 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_1100y;
                    f1z = aj2 * hrr_0200z;
                    f1z -= 1 * wt;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_20y;
                    f2z = ai2 * hrr_1100z;
                    f2y -= 1 * 1;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_2100y;
                    f3z = ai2 * hrr_1200z;
                    f3y -= 1 * hrr_0100y;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3z -= 1 * (ai2 * trr_10z);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_30y - 3 * Iy);
                    f3z = ai2 * (ai2 * hrr_2100z - 1 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_1200y - 1 * Iy);
                    f3z = aj2 * (aj2 * hrr_0300z - 3 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = hrr_1100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = aj2 * hrr_0100x;
                    f1y = aj2 * hrr_0100y;
                    f1z = aj2 * hrr_1200z;
                    f1z -= 1 * trr_10z;
                    f2x = ai2 * trr_10x;
                    f2y = ai2 * trr_10y;
                    f2z = ai2 * hrr_2100z;
                    f2z -= 1 * hrr_0100z;
                    f3x = ai2 * hrr_1100x;
                    f3y = ai2 * hrr_1100y;
                    double trr_40z = c0z * trr_30z + 3*b10 * trr_20z;
                    double hrr_3100z = trr_40z - zjzi * trr_30z;
                    double hrr_2200z = hrr_3100z - zjzi * hrr_2100z;
                    f3z = ai2 * hrr_2200z;
                    f3z -= 1 * hrr_0200z;
                    f3x *= aj2;
                    f3y *= aj2;
                    f3z *= aj2;
                    f3z -= 1 * (ai2 * trr_20z - 1 * wt);
                    v1xx += f3x * prod_yz;
                    v1yy += f3y * prod_xz;
                    v1zz += f3z * prod_xy;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f3x = ai2 * (ai2 * trr_20x - 1 * Ix);
                    f3y = ai2 * (ai2 * trr_20y - 1 * Iy);
                    f3z = ai2 * (ai2 * hrr_3100z - 3 * Iz);
                    v_ixx += f3x * prod_yz;
                    v_iyy += f3y * prod_xz;
                    v_izz += f3z * prod_xy;
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    f3x = aj2 * (aj2 * hrr_0200x - 1 * Ix);
                    f3y = aj2 * (aj2 * hrr_0200y - 1 * Iy);
                    double hrr_1300z = hrr_2200z - zjzi * hrr_1200z;
                    f3z = aj2 * (aj2 * hrr_1300z - 3 * Iz);
                    v_jxx += f3x * prod_yz;
                    v_jyy += f3y * prod_xz;
                    v_jzz += f3z * prod_xy;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    }
                    {
                    double wt = rw[(2*irys+1)*nsq_per_block] * fac;
                    double rt = rw[ 2*irys   *nsq_per_block];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double c0x = xpa - xpq*rt_aij;
                    double trr_10x = c0x * 1;
                    double b10 = .5/aij * (1 - rt_aij);
                    double trr_20x = c0x * trr_10x + 1*b10 * 1;
                    double hrr_1100x = trr_20x - xjxi * trr_10x;
                    dd = dd_cache0;
                    Ix = hrr_1100x;
                    Iy = 1;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double rt_akl = rt_aa * aij;
                    double cpx = xqc + xpq*rt_akl;
                    double b00 = .5 * rt_aa;
                    double trr_21x = cpx * trr_20x + 2*b00 * trr_10x;
                    double hrr_2001x = trr_21x - xlxk * trr_20x;
                    double trr_11x = cpx * trr_10x + 1*b00 * 1;
                    double hrr_1001x = trr_11x - xlxk * trr_10x;
                    double hrr_1101x = hrr_2001x - xjxi * hrr_1001x;
                    f1x = al2 * hrr_1101x;
                    double cpy = yqc + ypq*rt_akl;
                    double trr_01y = cpy * 1;
                    double hrr_0001y = trr_01y - ylyk * 1;
                    f1y = al2 * hrr_0001y;
                    double cpz = zqc + zpq*rt_akl;
                    double trr_01z = cpz * wt;
                    double hrr_0001z = trr_01z - zlzk * wt;
                    f1z = al2 * hrr_0001z;
                    double hrr_1110x = trr_21x - xjxi * trr_11x;
                    f2x = ak2 * hrr_1110x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_01z;
                    double b01 = .5/akl * (1 - rt_akl);
                    double trr_22x = cpx * trr_21x + 1*b01 * trr_20x + 2*b00 * trr_11x;
                    double hrr_2011x = trr_22x - xlxk * trr_21x;
                    double trr_01x = cpx * 1;
                    double trr_12x = cpx * trr_11x + 1*b01 * trr_10x + 1*b00 * trr_01x;
                    double hrr_1011x = trr_12x - xlxk * trr_11x;
                    double hrr_1111x = hrr_2011x - xjxi * hrr_1011x;
                    f3x = ak2 * hrr_1111x;
                    double trr_02y = cpy * trr_01y + 1*b01 * 1;
                    double hrr_0011y = trr_02y - ylyk * trr_01y;
                    f3y = ak2 * hrr_0011y;
                    double trr_02z = cpz * trr_01z + 1*b01 * wt;
                    double hrr_0011z = trr_02z - zlzk * trr_01z;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    double hrr_1120x = trr_22x - xjxi * trr_12x;
                    f3x = ak2 * (ak2 * hrr_1120x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_2002x = hrr_2011x - xlxk * hrr_2001x;
                    double hrr_1002x = hrr_1011x - xlxk * hrr_1001x;
                    double hrr_1102x = hrr_2002x - xjxi * hrr_1002x;
                    f3x = al2 * (al2 * hrr_1102x - 1 * Ix);
                    double hrr_0002y = hrr_0011y - ylyk * hrr_0001y;
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0002z = hrr_0011z - zlzk * hrr_0001z;
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double hrr_0100x = trr_10x - xjxi * 1;
                    double c0y = ypa - ypq*rt_aij;
                    double trr_10y = c0y * 1;
                    dd = dd_cache1;
                    Ix = hrr_0100x;
                    Iy = trr_10y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    double hrr_0001x = trr_01x - xlxk * 1;
                    double hrr_0101x = hrr_1001x - xjxi * hrr_0001x;
                    f1x = al2 * hrr_0101x;
                    double trr_11y = cpy * trr_10y + 1*b00 * 1;
                    double hrr_1001y = trr_11y - ylyk * trr_10y;
                    f1y = al2 * hrr_1001y;
                    f1z = al2 * hrr_0001z;
                    double hrr_0110x = trr_11x - xjxi * trr_01x;
                    f2x = ak2 * hrr_0110x;
                    f2y = ak2 * trr_11y;
                    f2z = ak2 * trr_01z;
                    double trr_02x = cpx * trr_01x + 1*b01 * 1;
                    double hrr_0011x = trr_02x - xlxk * trr_01x;
                    double hrr_0111x = hrr_1011x - xjxi * hrr_0011x;
                    f3x = ak2 * hrr_0111x;
                    double trr_12y = cpy * trr_11y + 1*b01 * trr_10y + 1*b00 * trr_01y;
                    double hrr_1011y = trr_12y - ylyk * trr_11y;
                    f3y = ak2 * hrr_1011y;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    double hrr_0120x = trr_12x - xjxi * trr_02x;
                    f3x = ak2 * (ak2 * hrr_0120x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_12y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    double hrr_0002x = hrr_0011x - xlxk * hrr_0001x;
                    double hrr_0102x = hrr_1002x - xjxi * hrr_0002x;
                    f3x = al2 * (al2 * hrr_0102x - 1 * Ix);
                    double hrr_1002y = hrr_1011y - ylyk * hrr_1001y;
                    f3y = al2 * (al2 * hrr_1002y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double c0z = zpa - zpq*rt_aij;
                    double trr_10z = c0z * wt;
                    dd = dd_cache2;
                    Ix = hrr_0100x;
                    Iy = 1;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0101x;
                    f1y = al2 * hrr_0001y;
                    double trr_11z = cpz * trr_10z + 1*b00 * wt;
                    double hrr_1001z = trr_11z - zlzk * trr_10z;
                    f1z = al2 * hrr_1001z;
                    f2x = ak2 * hrr_0110x;
                    f2y = ak2 * trr_01y;
                    f2z = ak2 * trr_11z;
                    f3x = ak2 * hrr_0111x;
                    f3y = ak2 * hrr_0011y;
                    double trr_12z = cpz * trr_11z + 1*b01 * trr_10z + 1*b00 * trr_01z;
                    double hrr_1011z = trr_12z - zlzk * trr_11z;
                    f3z = ak2 * hrr_1011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * hrr_0120x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_12z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0102x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_1002z = hrr_1011z - zlzk * hrr_1001z;
                    f3z = al2 * (al2 * hrr_1002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double hrr_0100y = trr_10y - yjyi * 1;
                    dd = dd_cache3;
                    Ix = trr_10x;
                    Iy = hrr_0100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_1001x;
                    double hrr_0101y = hrr_1001y - yjyi * hrr_0001y;
                    f1y = al2 * hrr_0101y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_11x;
                    double hrr_0110y = trr_11y - yjyi * trr_01y;
                    f2y = ak2 * hrr_0110y;
                    f2z = ak2 * trr_01z;
                    f3x = ak2 * hrr_1011x;
                    double hrr_0111y = hrr_1011y - yjyi * hrr_0011y;
                    f3y = ak2 * hrr_0111y;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_12x - 1 * Ix);
                    double hrr_0120y = trr_12y - yjyi * trr_02y;
                    f3y = ak2 * (ak2 * hrr_0120y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_1002x - 1 * Ix);
                    double hrr_0102y = hrr_1002y - yjyi * hrr_0002y;
                    f3y = al2 * (al2 * hrr_0102y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double trr_20y = c0y * trr_10y + 1*b10 * 1;
                    double hrr_1100y = trr_20y - yjyi * trr_10y;
                    dd = dd_cache4;
                    Ix = 1;
                    Iy = hrr_1100y;
                    Iz = wt;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    double trr_21y = cpy * trr_20y + 2*b00 * trr_10y;
                    double hrr_2001y = trr_21y - ylyk * trr_20y;
                    double hrr_1101y = hrr_2001y - yjyi * hrr_1001y;
                    f1y = al2 * hrr_1101y;
                    f1z = al2 * hrr_0001z;
                    f2x = ak2 * trr_01x;
                    double hrr_1110y = trr_21y - yjyi * trr_11y;
                    f2y = ak2 * hrr_1110y;
                    f2z = ak2 * trr_01z;
                    f3x = ak2 * hrr_0011x;
                    double trr_22y = cpy * trr_21y + 1*b01 * trr_20y + 2*b00 * trr_11y;
                    double hrr_2011y = trr_22y - ylyk * trr_21y;
                    double hrr_1111y = hrr_2011y - yjyi * hrr_1011y;
                    f3y = ak2 * hrr_1111y;
                    f3z = ak2 * hrr_0011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    double hrr_1120y = trr_22y - yjyi * trr_12y;
                    f3y = ak2 * (ak2 * hrr_1120y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_02z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    double hrr_2002y = hrr_2011y - ylyk * hrr_2001y;
                    double hrr_1102y = hrr_2002y - yjyi * hrr_1002y;
                    f3y = al2 * (al2 * hrr_1102y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache5;
                    Ix = 1;
                    Iy = hrr_0100y;
                    Iz = trr_10z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_0101y;
                    f1z = al2 * hrr_1001z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * hrr_0110y;
                    f2z = ak2 * trr_11z;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_0111y;
                    f3z = ak2 * hrr_1011z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * hrr_0120y - 1 * Iy);
                    f3z = ak2 * (ak2 * trr_12z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0102y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_1002z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double hrr_0100z = trr_10z - zjzi * wt;
                    dd = dd_cache6;
                    Ix = trr_10x;
                    Iy = 1;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_1001x;
                    f1y = al2 * hrr_0001y;
                    double hrr_0101z = hrr_1001z - zjzi * hrr_0001z;
                    f1z = al2 * hrr_0101z;
                    f2x = ak2 * trr_11x;
                    f2y = ak2 * trr_01y;
                    double hrr_0110z = trr_11z - zjzi * trr_01z;
                    f2z = ak2 * hrr_0110z;
                    f3x = ak2 * hrr_1011x;
                    f3y = ak2 * hrr_0011y;
                    double hrr_0111z = hrr_1011z - zjzi * hrr_0011z;
                    f3z = ak2 * hrr_0111z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_12x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    double hrr_0120z = trr_12z - zjzi * trr_02z;
                    f3z = ak2 * (ak2 * hrr_0120z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_1002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_0102z = hrr_1002z - zjzi * hrr_0002z;
                    f3z = al2 * (al2 * hrr_0102z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    dd = dd_cache7;
                    Ix = 1;
                    Iy = trr_10y;
                    Iz = hrr_0100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_1001y;
                    f1z = al2 * hrr_0101z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_11y;
                    f2z = ak2 * hrr_0110z;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_1011y;
                    f3z = ak2 * hrr_0111z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_12y - 1 * Iy);
                    f3z = ak2 * (ak2 * hrr_0120z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_1002y - 1 * Iy);
                    f3z = al2 * (al2 * hrr_0102z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    double trr_20z = c0z * trr_10z + 1*b10 * wt;
                    double hrr_1100z = trr_20z - zjzi * trr_10z;
                    dd = dd_cache8;
                    Ix = 1;
                    Iy = 1;
                    Iz = hrr_1100z;
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    prod_xy = Ix * Iydd;
                    prod_xz = Ix * Izdd;
                    prod_yz = Iy * Izdd;
                    f1x = al2 * hrr_0001x;
                    f1y = al2 * hrr_0001y;
                    double trr_21z = cpz * trr_20z + 2*b00 * trr_10z;
                    double hrr_2001z = trr_21z - zlzk * trr_20z;
                    double hrr_1101z = hrr_2001z - zjzi * hrr_1001z;
                    f1z = al2 * hrr_1101z;
                    f2x = ak2 * trr_01x;
                    f2y = ak2 * trr_01y;
                    double hrr_1110z = trr_21z - zjzi * trr_11z;
                    f2z = ak2 * hrr_1110z;
                    f3x = ak2 * hrr_0011x;
                    f3y = ak2 * hrr_0011y;
                    double trr_22z = cpz * trr_21z + 1*b01 * trr_20z + 2*b00 * trr_11z;
                    double hrr_2011z = trr_22z - zlzk * trr_21z;
                    double hrr_1111z = hrr_2011z - zjzi * hrr_1011z;
                    f3z = ak2 * hrr_1111z;
                    f3x *= al2;
                    f3y *= al2;
                    f3z *= al2;
                    v2xx += f3x * prod_yz;
                    v2yy += f3y * prod_xz;
                    v2zz += f3z * prod_xy;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    f3x = ak2 * (ak2 * trr_02x - 1 * Ix);
                    f3y = ak2 * (ak2 * trr_02y - 1 * Iy);
                    double hrr_1120z = trr_22z - zjzi * trr_12z;
                    f3z = ak2 * (ak2 * hrr_1120z - 1 * Iz);
                    v_kxx += f3x * prod_yz;
                    v_kyy += f3y * prod_xz;
                    v_kzz += f3z * prod_xy;
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    f3x = al2 * (al2 * hrr_0002x - 1 * Ix);
                    f3y = al2 * (al2 * hrr_0002y - 1 * Iy);
                    double hrr_2002z = hrr_2011z - zlzk * hrr_2001z;
                    double hrr_1102z = hrr_2002z - zjzi * hrr_1002z;
                    f3z = al2 * (al2 * hrr_1102z - 1 * Iz);
                    v_lxx += f3x * prod_yz;
                    v_lyy += f3y * prod_xz;
                    v_lzz += f3z * prod_xy;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1110(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 32;
    constexpr int gout_stride = 8;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 864 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 168 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (168+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[32] = ylyk;
            rlrk[64] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 27; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[32];
                double zlzk = rlrk[64];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[32] * al_akl;
                double zkl = rk[2] + rlrk[64] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[32] = ypq;
                    Rpq[64] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1728] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*64];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 8) {
                        if (n == 2) {
                            gx[3456] = rw[irys*64+32];
                        }
                        double *_gx = gx + n * 1728;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[32] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[64] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 2 * b10 * s0;
                        _gx[96] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 3 * b10 * s0;
                        _gx[128] = s2;
                        double xlxk = rlrk[n*32];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*32];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[288] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[576] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        _gx[864] = s2;
                        s0 = _gx[32];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[320] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[288];
                        _gx[608] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 1 * b00 * _gx[576];
                        _gx[896] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[32];
                        _gx[352] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[320];
                        _gx[640] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 2 * b00 * _gx[608];
                        _gx[928] = s2;
                        s0 = _gx[96];
                        s1 = cpx * s0;
                        s1 += 3 * b00 * _gx[64];
                        _gx[384] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 3 * b00 * _gx[352];
                        _gx[672] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 3 * b00 * _gx[640];
                        _gx[960] = s2;
                        s0 = _gx[128];
                        s1 = cpx * s0;
                        s1 += 4 * b00 * _gx[96];
                        _gx[416] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 4 * b00 * _gx[384];
                        _gx[704] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 4 * b00 * _gx[672];
                        _gx[992] = s2;
                        s1 = _gx[128];
                        s0 = _gx[96];
                        _gx[192] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[160] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[128] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[96] = s1 - xjxi * s0;
                        s1 = _gx[192];
                        s0 = _gx[160];
                        _gx[256] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[224] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[96];
                        _gx[192] = s1 - xjxi * s0;
                        s1 = _gx[416];
                        s0 = _gx[384];
                        _gx[480] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[448] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[416] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[384] = s1 - xjxi * s0;
                        s1 = _gx[480];
                        s0 = _gx[448];
                        _gx[544] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[512] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[480] = s1 - xjxi * s0;
                        s1 = _gx[704];
                        s0 = _gx[672];
                        _gx[768] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[640];
                        _gx[736] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[704] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[672] = s1 - xjxi * s0;
                        s1 = _gx[768];
                        s0 = _gx[736];
                        _gx[832] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[704];
                        _gx[800] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[672];
                        _gx[768] = s1 - xjxi * s0;
                        s1 = _gx[992];
                        s0 = _gx[960];
                        _gx[1056] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[928];
                        _gx[1024] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[896];
                        _gx[992] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[864];
                        _gx[960] = s1 - xjxi * s0;
                        s1 = _gx[1056];
                        s0 = _gx[1024];
                        _gx[1120] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[992];
                        _gx[1088] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[960];
                        _gx[1056] = s1 - xjxi * s0;
                        s1 = _gx[864];
                        s0 = _gx[576];
                        _gx[1440] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[1152] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[864] = s1 - xlxk * s0;
                        s1 = _gx[896];
                        s0 = _gx[608];
                        _gx[1472] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[1184] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = _gx[928];
                        s0 = _gx[640];
                        _gx[1504] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[1216] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[928] = s1 - xlxk * s0;
                        s1 = _gx[960];
                        s0 = _gx[672];
                        _gx[1536] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[1248] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[96];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = _gx[992];
                        s0 = _gx[704];
                        _gx[1568] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[1280] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[992] = s1 - xlxk * s0;
                        s1 = _gx[1024];
                        s0 = _gx[736];
                        _gx[1600] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[448];
                        _gx[1312] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[160];
                        _gx[1024] = s1 - xlxk * s0;
                        s1 = _gx[1056];
                        s0 = _gx[768];
                        _gx[1632] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[480];
                        _gx[1344] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[1056] = s1 - xlxk * s0;
                        s1 = _gx[1088];
                        s0 = _gx[800];
                        _gx[1664] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[512];
                        _gx[1376] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[1088] = s1 - xlxk * s0;
                        s1 = _gx[1120];
                        s0 = _gx[832];
                        _gx[1696] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[544];
                        _gx[1408] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[256];
                        _gx[1120] = s1 - xlxk * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[416];
                    Iy = gx[1728];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[512] - 1 * gx[320];
                    f2x = ai2 * gx[448] - 1 * gx[384];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1280];
                    f2x = ak2 * gx[704] - 1 * gx[128];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[544] + gx[448] * xjxi) - 3 * gx[416]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[544] - gx[512] * xjxi) - 3 * gx[416]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1568] - gx[1280] * xlxk) - 1 * gx[416]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1568] + gx[704] * xlxk) - 3 * gx[416]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[544] - 1 * gx[480]) - 1 * (ai2 * gx[352] - 1 * gx[288])) * prod_yz;
                    v2xx += al2 * (ak2 * gx[1568] - 1 * gx[992]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[288];
                    Iy = gx[1728];
                    Iz = gx[3584];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[384];
                    f2x = ai2 * gx[320];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3680] - 1 * gx[3488];
                    f2z = ai2 * gx[3616] - 1 * gx[3552];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152];
                    f2x = ak2 * gx[576] - 1 * gx[0];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4448];
                    f2z = ak2 * gx[3872];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[480] - 1 * gx[288]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1440] - gx[1152] * xlxk) - 1 * gx[288]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1440] + gx[576] * xlxk) - 3 * gx[288]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3712] + gx[3616] * zjzi) - 3 * gx[3584]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3712] - gx[3680] * zjzi) - 3 * gx[3584]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4736] - gx[4448] * zlzk) - 1 * gx[3584]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4160] - 1 * gx[3584]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[416] * prod_yz;
                    v2xx += al2 * (ak2 * gx[1440] - 1 * gx[864]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[3712] - 1 * gx[3648]) - 1 * (ai2 * gx[3520] - 1 * gx[3456])) * prod_xy;
                    v2zz += al2 * ak2 * gx[4736] * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[0];
                    Iy = gx[2048];
                    Iz = gx[3552];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2144];
                    f2y = ai2 * gx[2080] - 1 * gx[2016];
                    f1z = aj2 * gx[3648] - 1 * gx[3456];
                    f2z = ai2 * gx[3584];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2912];
                    f2y = ak2 * gx[2336] - 1 * gx[1760];
                    f1z = al2 * gx[4416];
                    f2z = ak2 * gx[3840];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2176] + gx[2080] * yjyi) - 3 * gx[2048]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2240] - 1 * gx[2048]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3200] - gx[2912] * ylyk) - 1 * gx[2048]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3200] + gx[2336] * ylyk) - 3 * gx[2048]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3680] - gx[3648] * zjzi) - 3 * gx[3552]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4704] - gx[4416] * zlzk) - 1 * gx[3552]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4128] - 1 * gx[3552]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2176] - 1 * gx[2112]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[3200] - 1 * gx[2624]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3680] - 1 * ai2 * gx[3488]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4704] * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[32];
                    Iy = gx[1728];
                    Iz = gx[3840];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3936] - 1 * gx[3744];
                    f2z = ai2 * gx[3872];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[896];
                    f2x = ak2 * gx[320];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4704];
                    f2z = ak2 * gx[4128] - 1 * gx[3552];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[224] - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1184] - gx[896] * xlxk) - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[608] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3904] - 1 * gx[3840]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3968] - gx[3936] * zjzi) - 3 * gx[3840]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4992] - gx[4704] * zlzk) - 1 * gx[3840]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4992] + gx[4128] * zlzk) - 3 * gx[3840]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1184] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3968] - 1 * ai2 * gx[3776]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4992] - 1 * gx[4416]) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[32];
                    Ix = gx[384];
                    Iy = gx[1760];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480] - 1 * gx[288];
                    f2x = ai2 * gx[416];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1248];
                    f2x = ak2 * gx[672] - 1 * gx[96];
                    f1y = al2 * gx[2624];
                    f2y = ak2 * gx[2048];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[448] - 1 * gx[384]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[512] - gx[480] * xjxi) - 3 * gx[384]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1536] - gx[1248] * xlxk) - 1 * gx[384]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1536] + gx[672] * xlxk) - 3 * gx[384]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1952] - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2912] - gx[2624] * ylyk) - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2336] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[512] - 1 * ai2 * gx[320]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[1536] - 1 * gx[960]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2912] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[288];
                    Ix = gx[128];
                    Iy = gx[2016];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[224] - 1 * gx[32];
                    f2x = ai2 * gx[160] - 1 * gx[96];
                    f1y = aj2 * gx[2112];
                    f2y = ai2 * gx[2048];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[992];
                    f2x = ak2 * gx[416];
                    f1y = al2 * gx[2880];
                    f2y = ak2 * gx[2304] - 1 * gx[1728];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[256] + gx[160] * xjxi) - 3 * gx[128]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[224] * xjxi) - 3 * gx[128]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1280] - gx[992] * xlxk) - 1 * gx[128]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[704] - 1 * gx[128]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2208] - 1 * gx[2016]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3168] - gx[2880] * ylyk) - 1 * gx[2016]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3168] + gx[2304] * ylyk) - 3 * gx[2016]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[256] - 1 * gx[192]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[1280] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2144] * prod_xz;
                    v2yy += al2 * (ak2 * gx[3168] - 1 * gx[2592]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[544];
                    Ix = gx[0];
                    Iy = gx[2016];
                    Iz = gx[3584];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2112];
                    f2y = ai2 * gx[2048];
                    f1z = aj2 * gx[3680] - 1 * gx[3488];
                    f2z = ai2 * gx[3616] - 1 * gx[3552];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2880];
                    f2y = ak2 * gx[2304] - 1 * gx[1728];
                    f1z = al2 * gx[4448];
                    f2z = ak2 * gx[3872];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2208] - 1 * gx[2016]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3168] - gx[2880] * ylyk) - 1 * gx[2016]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3168] + gx[2304] * ylyk) - 3 * gx[2016]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3712] + gx[3616] * zjzi) - 3 * gx[3584]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3712] - gx[3680] * zjzi) - 3 * gx[3584]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4736] - gx[4448] * zlzk) - 1 * gx[3584]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4160] - 1 * gx[3584]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2144] * prod_xz;
                    v2yy += al2 * (ak2 * gx[3168] - 1 * gx[2592]) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[3712] - 1 * gx[3648]) - 1 * (ai2 * gx[3520] - 1 * gx[3456])) * prod_xy;
                    v2zz += al2 * ak2 * gx[4736] * prod_xy;
                    dd = dd_cache[800];
                    Ix = gx[0];
                    Iy = gx[1760];
                    Iz = gx[3840];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3936] - 1 * gx[3744];
                    f2z = ai2 * gx[3872];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2624];
                    f2y = ak2 * gx[2048];
                    f1z = al2 * gx[4704];
                    f2z = ak2 * gx[4128] - 1 * gx[3552];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1952] - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2912] - gx[2624] * ylyk) - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2336] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3904] - 1 * gx[3840]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3968] - gx[3936] * zjzi) - 3 * gx[3840]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4992] - gx[4704] * zlzk) - 1 * gx[3840]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4992] + gx[4128] * zlzk) - 3 * gx[3840]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2912] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3968] - 1 * ai2 * gx[3776]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4992] - 1 * gx[4416]) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[64];
                    Ix = gx[384];
                    Iy = gx[1728];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480] - 1 * gx[288];
                    f2x = ai2 * gx[416];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1248];
                    f2x = ak2 * gx[672] - 1 * gx[96];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4352];
                    f2z = ak2 * gx[3776];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[448] - 1 * gx[384]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[512] - gx[480] * xjxi) - 3 * gx[384]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1536] - gx[1248] * xlxk) - 1 * gx[384]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1536] + gx[672] * xlxk) - 3 * gx[384]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3680] - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4640] - gx[4352] * zlzk) - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4064] - 1 * gx[3488]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[512] - 1 * ai2 * gx[320]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[1536] - 1 * gx[960]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4640] * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[96];
                    Iy = gx[2048];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192] - 1 * gx[0];
                    f2x = ai2 * gx[128];
                    f1y = aj2 * gx[2144];
                    f2y = ai2 * gx[2080] - 1 * gx[2016];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[960];
                    f2x = ak2 * gx[384];
                    f1y = al2 * gx[2912];
                    f2y = ak2 * gx[2336] - 1 * gx[1760];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[224] - gx[192] * xjxi) - 3 * gx[96]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1248] - gx[960] * xlxk) - 1 * gx[96]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[672] - 1 * gx[96]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2176] + gx[2080] * yjyi) - 3 * gx[2048]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2240] - 1 * gx[2048]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3200] - gx[2912] * ylyk) - 1 * gx[2048]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3200] + gx[2336] * ylyk) - 3 * gx[2048]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[224] - 1 * ai2 * gx[32]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1248] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[2176] - 1 * gx[2112]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[3200] - 1 * gx[2624]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[128];
                    Iy = gx[1728];
                    Iz = gx[3744];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[224] - 1 * gx[32];
                    f2x = ai2 * gx[160] - 1 * gx[96];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3840];
                    f2z = ai2 * gx[3776];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[992];
                    f2x = ak2 * gx[416];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4608];
                    f2z = ak2 * gx[4032] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[256] + gx[160] * xjxi) - 3 * gx[128]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[224] * xjxi) - 3 * gx[128]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1280] - gx[992] * xlxk) - 1 * gx[128]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[704] - 1 * gx[128]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3936] - 1 * gx[3744]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4896] - gx[4608] * zlzk) - 1 * gx[3744]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4896] + gx[4032] * zlzk) - 3 * gx[3744]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[256] - 1 * gx[192]) - 1 * (ai2 * gx[64] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[1280] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3872] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4896] - 1 * gx[4320]) * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[3872];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3968] - 1 * gx[3776];
                    f2z = ai2 * gx[3904] - 1 * gx[3840];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4736];
                    f2z = ak2 * gx[4160] - 1 * gx[3584];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[4000] + gx[3904] * zjzi) - 3 * gx[3872]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[4000] - gx[3968] * zjzi) - 3 * gx[3872]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[5024] - gx[4736] * zlzk) - 1 * gx[3872]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[5024] + gx[4160] * zlzk) - 3 * gx[3872]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[4000] - 1 * gx[3936]) - 1 * (ai2 * gx[3808] - 1 * gx[3744])) * prod_xy;
                    v2zz += al2 * (ak2 * gx[5024] - 1 * gx[4448]) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[96];
                    Ix = gx[320];
                    Iy = gx[1824];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[416];
                    f2x = ai2 * gx[352] - 1 * gx[288];
                    f1y = aj2 * gx[1920] - 1 * gx[1728];
                    f2y = ai2 * gx[1856];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1184];
                    f2x = ak2 * gx[608] - 1 * gx[32];
                    f1y = al2 * gx[2688];
                    f2y = ak2 * gx[2112];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[448] + gx[352] * xjxi) - 3 * gx[320]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[512] - 1 * gx[320]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1472] - gx[1184] * xlxk) - 1 * gx[320]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1472] + gx[608] * xlxk) - 3 * gx[320]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1952] - gx[1920] * yjyi) - 3 * gx[1824]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2976] - gx[2688] * ylyk) - 1 * gx[1824]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2400] - 1 * gx[1824]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[448] - 1 * gx[384]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[1472] - 1 * gx[896]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1952] - 1 * ai2 * gx[1760]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2976] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[352];
                    Ix = gx[96];
                    Iy = gx[2016];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192] - 1 * gx[0];
                    f2x = ai2 * gx[128];
                    f1y = aj2 * gx[2112];
                    f2y = ai2 * gx[2048];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[960];
                    f2x = ak2 * gx[384];
                    f1y = al2 * gx[2880];
                    f2y = ak2 * gx[2304] - 1 * gx[1728];
                    f1z = al2 * gx[4352];
                    f2z = ak2 * gx[3776];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[224] - gx[192] * xjxi) - 3 * gx[96]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1248] - gx[960] * xlxk) - 1 * gx[96]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[672] - 1 * gx[96]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2208] - 1 * gx[2016]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3168] - gx[2880] * ylyk) - 1 * gx[2016]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3168] + gx[2304] * ylyk) - 3 * gx[2016]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3680] - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4640] - gx[4352] * zlzk) - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4064] - 1 * gx[3488]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[224] - 1 * ai2 * gx[32]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1248] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2144] * prod_xz;
                    v2yy += al2 * (ak2 * gx[3168] - 1 * gx[2592]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4640] * prod_xy;
                    dd = dd_cache[608];
                    Ix = gx[96];
                    Iy = gx[1760];
                    Iz = gx[3744];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192] - 1 * gx[0];
                    f2x = ai2 * gx[128];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3840];
                    f2z = ai2 * gx[3776];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[960];
                    f2x = ak2 * gx[384];
                    f1y = al2 * gx[2624];
                    f2y = ak2 * gx[2048];
                    f1z = al2 * gx[4608];
                    f2z = ak2 * gx[4032] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[224] - gx[192] * xjxi) - 3 * gx[96]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1248] - gx[960] * xlxk) - 1 * gx[96]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[672] - 1 * gx[96]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1952] - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2912] - gx[2624] * ylyk) - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2336] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3936] - 1 * gx[3744]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4896] - gx[4608] * zlzk) - 1 * gx[3744]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4896] + gx[4032] * zlzk) - 3 * gx[3744]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[224] - 1 * ai2 * gx[32]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1248] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2912] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3872] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4896] - 1 * gx[4320]) * prod_xy;
                    break;
                    case 4:
                    dd = dd_cache[128];
                    Ix = gx[288];
                    Iy = gx[1856];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[384];
                    f2x = ai2 * gx[320];
                    f1y = aj2 * gx[1952] - 1 * gx[1760];
                    f2y = ai2 * gx[1888] - 1 * gx[1824];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152];
                    f2x = ak2 * gx[576] - 1 * gx[0];
                    f1y = al2 * gx[2720];
                    f2y = ak2 * gx[2144];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[480] - 1 * gx[288]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1440] - gx[1152] * xlxk) - 1 * gx[288]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1440] + gx[576] * xlxk) - 3 * gx[288]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1984] + gx[1888] * yjyi) - 3 * gx[1856]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1984] - gx[1952] * yjyi) - 3 * gx[1856]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3008] - gx[2720] * ylyk) - 1 * gx[1856]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2432] - 1 * gx[1856]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[416] * prod_yz;
                    v2xx += al2 * (ak2 * gx[1440] - 1 * gx[864]) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1984] - 1 * gx[1920]) - 1 * (ai2 * gx[1792] - 1 * gx[1728])) * prod_xz;
                    v2yy += al2 * ak2 * gx[3008] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[32];
                    Iy = gx[2112];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[2208] - 1 * gx[2016];
                    f2y = ai2 * gx[2144];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[896];
                    f2x = ak2 * gx[320];
                    f1y = al2 * gx[2976];
                    f2y = ak2 * gx[2400] - 1 * gx[1824];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[224] - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1184] - gx[896] * xlxk) - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[608] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2176] - 1 * gx[2112]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2240] - gx[2208] * yjyi) - 3 * gx[2112]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3264] - gx[2976] * ylyk) - 1 * gx[2112]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3264] + gx[2400] * ylyk) - 3 * gx[2112]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1184] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[2240] - 1 * ai2 * gx[2048]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[3264] - 1 * gx[2688]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[96];
                    Iy = gx[1728];
                    Iz = gx[3776];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192] - 1 * gx[0];
                    f2x = ai2 * gx[128];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3872];
                    f2z = ai2 * gx[3808] - 1 * gx[3744];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[960];
                    f2x = ak2 * gx[384];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4640];
                    f2z = ak2 * gx[4064] - 1 * gx[3488];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[224] - gx[192] * xjxi) - 3 * gx[96]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1248] - gx[960] * xlxk) - 1 * gx[96]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[672] - 1 * gx[96]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3904] + gx[3808] * zjzi) - 3 * gx[3776]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3968] - 1 * gx[3776]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4928] - gx[4640] * zlzk) - 1 * gx[3776]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4928] + gx[4064] * zlzk) - 3 * gx[3776]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[224] - 1 * ai2 * gx[32]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1248] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3904] - 1 * gx[3840]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4928] - 1 * gx[4352]) * prod_xy;
                    break;
                    case 5:
                    dd = dd_cache[160];
                    Ix = gx[288];
                    Iy = gx[1824];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[384];
                    f2x = ai2 * gx[320];
                    f1y = aj2 * gx[1920] - 1 * gx[1728];
                    f2y = ai2 * gx[1856];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152];
                    f2x = ak2 * gx[576] - 1 * gx[0];
                    f1y = al2 * gx[2688];
                    f2y = ak2 * gx[2112];
                    f1z = al2 * gx[4352];
                    f2z = ak2 * gx[3776];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[480] - 1 * gx[288]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1440] - gx[1152] * xlxk) - 1 * gx[288]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1440] + gx[576] * xlxk) - 3 * gx[288]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1952] - gx[1920] * yjyi) - 3 * gx[1824]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2976] - gx[2688] * ylyk) - 1 * gx[1824]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2400] - 1 * gx[1824]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3680] - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4640] - gx[4352] * zlzk) - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4064] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[416] * prod_yz;
                    v2xx += al2 * (ak2 * gx[1440] - 1 * gx[864]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1952] - 1 * ai2 * gx[1760]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2976] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4640] * prod_xy;
                    dd = dd_cache[416];
                    Ix = gx[0];
                    Iy = gx[2144];
                    Iz = gx[3456];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2240] - 1 * gx[2048];
                    f2y = ai2 * gx[2176] - 1 * gx[2112];
                    f1z = aj2 * gx[3552];
                    f2z = ai2 * gx[3488];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[3008];
                    f2y = ak2 * gx[2432] - 1 * gx[1856];
                    f1z = al2 * gx[4320];
                    f2z = ak2 * gx[3744];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2272] + gx[2176] * yjyi) - 3 * gx[2144]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2272] - gx[2240] * yjyi) - 3 * gx[2144]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3296] - gx[3008] * ylyk) - 1 * gx[2144]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3296] + gx[2432] * ylyk) - 3 * gx[2144]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3520] - 1 * gx[3456]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3648] - 1 * gx[3456]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4608] - gx[4320] * zlzk) - 1 * gx[3456]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4032] - 1 * gx[3456]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[2272] - 1 * gx[2208]) - 1 * (ai2 * gx[2080] - 1 * gx[2016])) * prod_xz;
                    v2yy += al2 * (ak2 * gx[3296] - 1 * gx[2720]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3584] * prod_xy;
                    v2zz += al2 * ak2 * gx[4608] * prod_xy;
                    dd = dd_cache[672];
                    Ix = gx[32];
                    Iy = gx[1824];
                    Iz = gx[3744];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[1920] - 1 * gx[1728];
                    f2y = ai2 * gx[1856];
                    f1z = aj2 * gx[3840];
                    f2z = ai2 * gx[3776];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[896];
                    f2x = ak2 * gx[320];
                    f1y = al2 * gx[2688];
                    f2y = ak2 * gx[2112];
                    f1z = al2 * gx[4608];
                    f2z = ak2 * gx[4032] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[224] - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1184] - gx[896] * xlxk) - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[608] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1952] - gx[1920] * yjyi) - 3 * gx[1824]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2976] - gx[2688] * ylyk) - 1 * gx[1824]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2400] - 1 * gx[1824]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3936] - 1 * gx[3744]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4896] - gx[4608] * zlzk) - 1 * gx[3744]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4896] + gx[4032] * zlzk) - 3 * gx[3744]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1184] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1952] - 1 * ai2 * gx[1760]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2976] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3872] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4896] - 1 * gx[4320]) * prod_xy;
                    break;
                    case 6:
                    dd = dd_cache[192];
                    Ix = gx[320];
                    Iy = gx[1728];
                    Iz = gx[3552];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[416];
                    f2x = ai2 * gx[352] - 1 * gx[288];
                    f1y = aj2 * gx[1824];
                    f2y = ai2 * gx[1760];
                    f1z = aj2 * gx[3648] - 1 * gx[3456];
                    f2z = ai2 * gx[3584];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1184];
                    f2x = ak2 * gx[608] - 1 * gx[32];
                    f1y = al2 * gx[2592];
                    f2y = ak2 * gx[2016];
                    f1z = al2 * gx[4416];
                    f2z = ak2 * gx[3840];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[448] + gx[352] * xjxi) - 3 * gx[320]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[512] - 1 * gx[320]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1472] - gx[1184] * xlxk) - 1 * gx[320]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1472] + gx[608] * xlxk) - 3 * gx[320]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1792] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1920] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2880] - gx[2592] * ylyk) - 1 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2304] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3680] - gx[3648] * zjzi) - 3 * gx[3552]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4704] - gx[4416] * zlzk) - 1 * gx[3552]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4128] - 1 * gx[3552]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[448] - 1 * gx[384]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[1472] - 1 * gx[896]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1856] * prod_xz;
                    v2yy += al2 * ak2 * gx[2880] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3680] - 1 * ai2 * gx[3488]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4704] * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[0];
                    Iy = gx[2112];
                    Iz = gx[3488];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[2208] - 1 * gx[2016];
                    f2y = ai2 * gx[2144];
                    f1z = aj2 * gx[3584];
                    f2z = ai2 * gx[3520] - 1 * gx[3456];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2976];
                    f2y = ak2 * gx[2400] - 1 * gx[1824];
                    f1z = al2 * gx[4352];
                    f2z = ak2 * gx[3776];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2176] - 1 * gx[2112]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2240] - gx[2208] * yjyi) - 3 * gx[2112]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3264] - gx[2976] * ylyk) - 1 * gx[2112]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3264] + gx[2400] * ylyk) - 3 * gx[2112]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3616] + gx[3520] * zjzi) - 3 * gx[3488]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3680] - 1 * gx[3488]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4640] - gx[4352] * zlzk) - 1 * gx[3488]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4064] - 1 * gx[3488]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[2240] - 1 * ai2 * gx[2048]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[3264] - 1 * gx[2688]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4640] * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[0];
                    Iy = gx[1856];
                    Iz = gx[3744];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1952] - 1 * gx[1760];
                    f2y = ai2 * gx[1888] - 1 * gx[1824];
                    f1z = aj2 * gx[3840];
                    f2z = ai2 * gx[3776];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2720];
                    f2y = ak2 * gx[2144];
                    f1z = al2 * gx[4608];
                    f2z = ak2 * gx[4032] - 1 * gx[3456];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1984] + gx[1888] * yjyi) - 3 * gx[1856]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1984] - gx[1952] * yjyi) - 3 * gx[1856]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3008] - gx[2720] * ylyk) - 1 * gx[1856]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2432] - 1 * gx[1856]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3808] - 1 * gx[3744]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3936] - 1 * gx[3744]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4896] - gx[4608] * zlzk) - 1 * gx[3744]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4896] + gx[4032] * zlzk) - 3 * gx[3744]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1984] - 1 * gx[1920]) - 1 * (ai2 * gx[1792] - 1 * gx[1728])) * prod_xz;
                    v2yy += al2 * ak2 * gx[3008] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3872] * prod_xy;
                    v2zz += al2 * (ak2 * gx[4896] - 1 * gx[4320]) * prod_xy;
                    break;
                    case 7:
                    dd = dd_cache[224];
                    Ix = gx[288];
                    Iy = gx[1760];
                    Iz = gx[3552];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[384];
                    f2x = ai2 * gx[320];
                    f1y = aj2 * gx[1856];
                    f2y = ai2 * gx[1792] - 1 * gx[1728];
                    f1z = aj2 * gx[3648] - 1 * gx[3456];
                    f2z = ai2 * gx[3584];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1152];
                    f2x = ak2 * gx[576] - 1 * gx[0];
                    f1y = al2 * gx[2624];
                    f2y = ak2 * gx[2048];
                    f1z = al2 * gx[4416];
                    f2z = ak2 * gx[3840];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[352] - 1 * gx[288]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[480] - 1 * gx[288]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1440] - gx[1152] * xlxk) - 1 * gx[288]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1440] + gx[576] * xlxk) - 3 * gx[288]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1888] + gx[1792] * yjyi) - 3 * gx[1760]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1952] - 1 * gx[1760]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2912] - gx[2624] * ylyk) - 1 * gx[1760]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2336] - 1 * gx[1760]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3680] - gx[3648] * zjzi) - 3 * gx[3552]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4704] - gx[4416] * zlzk) - 1 * gx[3552]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4128] - 1 * gx[3552]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[416] * prod_yz;
                    v2xx += al2 * (ak2 * gx[1440] - 1 * gx[864]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2912] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3680] - 1 * ai2 * gx[3488]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4704] * prod_xy;
                    dd = dd_cache[480];
                    Ix = gx[32];
                    Iy = gx[2016];
                    Iz = gx[3552];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[128];
                    f2x = ai2 * gx[64] - 1 * gx[0];
                    f1y = aj2 * gx[2112];
                    f2y = ai2 * gx[2048];
                    f1z = aj2 * gx[3648] - 1 * gx[3456];
                    f2z = ai2 * gx[3584];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[896];
                    f2x = ak2 * gx[320];
                    f1y = al2 * gx[2880];
                    f2y = ak2 * gx[2304] - 1 * gx[1728];
                    f1z = al2 * gx[4416];
                    f2z = ak2 * gx[3840];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[160] + gx[64] * xjxi) - 3 * gx[32]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[224] - 1 * gx[32]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1184] - gx[896] * xlxk) - 1 * gx[32]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[608] - 1 * gx[32]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[2080] - 1 * gx[2016]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[2208] - 1 * gx[2016]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[3168] - gx[2880] * ylyk) - 1 * gx[2016]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[3168] + gx[2304] * ylyk) - 3 * gx[2016]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3616] - 1 * gx[3552]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3680] - gx[3648] * zjzi) - 3 * gx[3552]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4704] - gx[4416] * zlzk) - 1 * gx[3552]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[4128] - 1 * gx[3552]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[160] - 1 * gx[96]) * prod_yz;
                    v2xx += al2 * ak2 * gx[1184] * prod_yz;
                    v1yy += aj2 * ai2 * gx[2144] * prod_xz;
                    v2yy += al2 * (ak2 * gx[3168] - 1 * gx[2592]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3680] - 1 * ai2 * gx[3488]) * prod_xy;
                    v2zz += al2 * ak2 * gx[4704] * prod_xy;
                    dd = dd_cache[736];
                    Ix = gx[0];
                    Iy = gx[1824];
                    Iz = gx[3776];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96];
                    f2x = ai2 * gx[32];
                    f1y = aj2 * gx[1920] - 1 * gx[1728];
                    f2y = ai2 * gx[1856];
                    f1z = aj2 * gx[3872];
                    f2z = ai2 * gx[3808] - 1 * gx[3744];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864];
                    f2x = ak2 * gx[288];
                    f1y = al2 * gx[2688];
                    f2y = ak2 * gx[2112];
                    f1z = al2 * gx[4640];
                    f2z = ak2 * gx[4064] - 1 * gx[3488];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[64] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[192] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[864] * xlxk) - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[576] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1888] - 1 * gx[1824]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1952] - gx[1920] * yjyi) - 3 * gx[1824]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2976] - gx[2688] * ylyk) - 1 * gx[1824]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2400] - 1 * gx[1824]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3904] + gx[3808] * zjzi) - 3 * gx[3776]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3968] - 1 * gx[3776]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[4928] - gx[4640] * zlzk) - 1 * gx[3776]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[4928] + gx[4064] * zlzk) - 3 * gx[3776]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[128] * prod_yz;
                    v2xx += al2 * ak2 * gx[1152] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1952] - 1 * ai2 * gx[1760]) * prod_xz;
                    v2yy += al2 * ak2 * gx[2976] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3904] - 1 * gx[3840]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[4928] - 1 * gx[4352]) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

__global__ static
void rys_ejk_ip2_type12_1111(RysIntEnvVars envs, JKEnergy jk, BoundsInfo bounds,
                     int *pool, double *dd_pool, int *head)
{
    int sq_id = threadIdx.x;
    int gout_id = threadIdx.y;
    constexpr int nsq_per_block = 16;
    constexpr int gout_stride = 16;
    int thread_id = threadIdx.y * nsq_per_block + threadIdx.x;
    int threads = nsq_per_block * gout_stride;
    int *bas_kl_idx = pool + blockIdx.x * QUEUE_DEPTH;
    double *dd_cache = dd_pool + blockIdx.x * 1296 + sq_id;
    __shared__ int ntasks, pair_ij;
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
while (pair_ij < bounds.npairs_ij) {
    int bas_ij = bounds.pair_ij_mapping[pair_ij];
    if (thread_id == 0) {
        ntasks = 0;
    }
    __syncthreads();
    if (jk.lr_factor != 0) {
        _fill_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    } else {
        _fill_sr_ejk_tasks(&ntasks, bas_kl_idx, bas_ij, jk, envs, bounds);
    }
    if (ntasks == 0) {
        if (thread_id == 0) {
            pair_ij = atomicAdd(head, 1);
        }
        __syncthreads();
        continue;
    }

    int nbas = envs.nbas;
    int *bas = envs.bas;
    double *env = envs.env;
    int iprim = bounds.iprim;
    int jprim = bounds.jprim;
    int kprim = bounds.kprim;
    int lprim = bounds.lprim;
    int nroots = bounds.nroots;
    extern __shared__ double shared_memory[];
    double *rlrk = shared_memory + sq_id;
    double *Rpq = shared_memory + nsq_per_block * 3 + sq_id;
    double *gx = shared_memory + nsq_per_block * 6 + sq_id;
    double *rw = shared_memory + nsq_per_block * 249 + sq_id;
    double *cicj_cache = shared_memory + nsq_per_block * (249+nroots*2);

    __shared__ int ish;
    __shared__ int jsh;
    __shared__ double ri[3];
    __shared__ double rjri[3];
    if (thread_id == 0) {
        ish = bas_ij / nbas;
        jsh = bas_ij % nbas;
    }
    __syncthreads();
    double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
    double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
    double *ci = env + bas[ish*BAS_SLOTS+PTR_COEFF];
    double *cj = env + bas[jsh*BAS_SLOTS+PTR_COEFF];
    if (thread_id < 3) {
        int ri_ptr = bas[ish*BAS_SLOTS+PTR_BAS_COORD];
        int rj_ptr = bas[jsh*BAS_SLOTS+PTR_BAS_COORD];
        ri[thread_id] = env[ri_ptr+thread_id];
        rjri[thread_id] = env[rj_ptr+thread_id] - ri[thread_id];
    }
    __syncthreads();
    double xjxi = rjri[0];
    double yjyi = rjri[1];
    double zjzi = rjri[2];
    for (int ij = thread_id; ij < iprim*jprim; ij += threads) {
        int ip = ij / jprim;
        int jp = ij % jprim;
        double ai = expi[ip];
        double aj = expj[jp];
        double aij = ai + aj;
        double theta_ij = ai * aj / aij;
        double rr_ij = xjxi*xjxi + yjyi*yjyi + zjzi*zjzi;
        double Kab = exp(-theta_ij * rr_ij);
        cicj_cache[ij] = ci[ip] * cj[jp] * Kab;
    }

    int *ao_loc = envs.ao_loc;
    int nao = ao_loc[nbas];
    double *dm = jk.dm;

    for (int task_id = sq_id; task_id < ntasks+sq_id; task_id += nsq_per_block) {
        __syncthreads();
        int bas_kl = bas_kl_idx[task_id];
        int ksh = bas_kl / nbas;
        int lsh = bas_kl % nbas;
        double fac_sym = PI_FAC;
        if (task_id < ntasks) {
            if (ish == jsh) fac_sym *= .5;
            if (ksh == lsh) fac_sym *= .5;
            if (ish*nbas+jsh == bas_kl) fac_sym *= .5;
        } else {
            fac_sym = 0;
        }
        int i0 = ao_loc[ish];
        int j0 = ao_loc[jsh];
        int k0 = ao_loc[ksh];
        int l0 = ao_loc[lsh];
        double *expi = env + bas[ish*BAS_SLOTS+PTR_EXP];
        double *expj = env + bas[jsh*BAS_SLOTS+PTR_EXP];
        double *expk = env + bas[ksh*BAS_SLOTS+PTR_EXP];
        double *expl = env + bas[lsh*BAS_SLOTS+PTR_EXP];
        double *ck = env + bas[ksh*BAS_SLOTS+PTR_COEFF];
        double *cl = env + bas[lsh*BAS_SLOTS+PTR_COEFF];
        double *rk = env + bas[ksh*BAS_SLOTS+PTR_BAS_COORD];
        double *rl = env + bas[lsh*BAS_SLOTS+PTR_BAS_COORD];
        double xlxk = rl[0] - rk[0];
        double ylyk = rl[1] - rk[1];
        double zlzk = rl[2] - rk[2];
        if (gout_id == 0) {
            rlrk[0] = xlxk;
            rlrk[16] = ylyk;
            rlrk[32] = zlzk;
        }
        double dd;
        double Ix, Iy, Iz;
        double Ixdd, Iydd, Izdd;
        double prod_xy, prod_xz, prod_yz;
        double f1x, f1y, f1z;
        double f2x, f2y, f2z;
        double v_ixx = 0;
        double v_ixy = 0;
        double v_ixz = 0;
        double v_iyy = 0;
        double v_iyz = 0;
        double v_izz = 0;
        double v_jxx = 0;
        double v_jxy = 0;
        double v_jxz = 0;
        double v_jyy = 0;
        double v_jyz = 0;
        double v_jzz = 0;
        double v_kxx = 0;
        double v_kxy = 0;
        double v_kxz = 0;
        double v_kyy = 0;
        double v_kyz = 0;
        double v_kzz = 0;
        double v_lxx = 0;
        double v_lxy = 0;
        double v_lxz = 0;
        double v_lyy = 0;
        double v_lyz = 0;
        double v_lzz = 0;
        double v1xx = 0;
        double v1xy = 0;
        double v1xz = 0;
        double v1yx = 0;
        double v1yy = 0;
        double v1yz = 0;
        double v1zx = 0;
        double v1zy = 0;
        double v1zz = 0;
        double v2xx = 0;
        double v2xy = 0;
        double v2xz = 0;
        double v2yx = 0;
        double v2yy = 0;
        double v2yz = 0;
        double v2zx = 0;
        double v2zy = 0;
        double v2zz = 0;
        int do_j = jk.j_factor != 0.;
        int do_k = jk.k_factor != 0.;
        if (jk.n_dm == 1) {
            for (int n = gout_id; n < 81; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm[_jk] * dm[_il] + dm[_jl] * dm[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * dm[_ji] * dm[_lk];
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        } else {
            double *dmb = dm + nao * nao;
            for (int n = gout_id; n < 81; n+=gout_stride) {
                int kl = n / 9;
                int ij = n % 9;
                int i = ij % 3;
                int j = ij / 3;
                int k = kl % 3;
                int l = kl / 3;
                int _i = i + i0;
                int _j = j + j0;
                int _k = k + k0;
                int _l = l + l0;
                int _jl = _j*nao+_l;
                int _jk = _j*nao+_k;
                int _il = _i*nao+_l;
                int _ik = _i*nao+_k;
                int _ji = _j*nao+_i;
                int _lk = _l*nao+_k;
                double dd = 0;
                if (do_k) {
                    dd += jk.k_factor * (dm [_jk] * dm [_il] + dm [_jl] * dm [_ik] +
                                         dmb[_jk] * dmb[_il] + dmb[_jl] * dmb[_ik]);
                }
                if (do_j) {
                    dd += jk.j_factor * (dm[_ji] + dmb[_ji]) * (dm[_lk] + dmb[_lk]);
                }
                dd_cache[n*nsq_per_block] = fac_sym * dd;
            }
        }
        for (int klp = 0; klp < kprim*lprim; ++klp) {
            int kp = klp / lprim;
            int lp = klp % lprim;
            double ak = expk[kp];
            double al = expl[lp];
            double ak2 = ak * 2;
            double al2 = al * 2;
            double akl = ak + al;
            double al_akl = al / akl;
            double theta_kl = ak * al_akl;
            __syncthreads();
            if (gout_id == 0) {
                double xlxk = rlrk[0];
                double ylyk = rlrk[16];
                double zlzk = rlrk[32];
                double Kcd = exp(-theta_kl * (xlxk*xlxk+ylyk*ylyk+zlzk*zlzk));
                double ckcl = ck[kp] * cl[lp] * Kcd;
                gx[0] = ckcl;
            }
            for (int ijp = 0; ijp < iprim*jprim; ++ijp) {
                int ip = ijp / jprim;
                int jp = ijp % jprim;
                double ai = expi[ip];
                double aj = expj[jp];
                double ai2 = ai * 2;
                double aj2 = aj * 2;
                double aij = ai + aj;
                double aj_aij = aj / aij;
                double xij = ri[0] + (rjri[0]) * aj_aij;
                double yij = ri[1] + (rjri[1]) * aj_aij;
                double zij = ri[2] + (rjri[2]) * aj_aij;
                double xkl = rk[0] + rlrk[0] * al_akl;
                double ykl = rk[1] + rlrk[16] * al_akl;
                double zkl = rk[2] + rlrk[32] * al_akl;
                double xpq = xij - xkl;
                double ypq = yij - ykl;
                double zpq = zij - zkl;
                double theta = aij * akl / (aij + akl);
                double rr = xpq * xpq + ypq * ypq + zpq * zpq;
                __syncthreads();
                if (gout_id == 0) {
                    Rpq[0] = xpq;
                    Rpq[16] = ypq;
                    Rpq[32] = zpq;
                    double cicj = cicj_cache[ijp];
                    gx[1296] = cicj / (aij*akl*sqrt(aij+akl));
                }
                int nroots = bounds.nroots;
                rys_roots_for_k(nroots, theta, rr, rw, jk.omega, jk.lr_factor, jk.sr_factor);
                double s0, s1, s2;
                for (int irys = 0; irys < nroots; ++irys) {
                    __syncthreads();
                    double rt = rw[irys*32];
                    double rt_aa = rt / (aij + akl);
                    double rt_aij = rt_aa * akl;
                    double rt_akl = rt_aa * aij;
                    double b00 = .5 * rt_aa;
                    double b10 = .5/aij * (1 - rt_aij);
                    double b01 = .5/akl * (1 - rt_akl);
                    for (int n = gout_id; n < 3; n += 16) {
                        if (n == 2) {
                            gx[2592] = rw[irys*32+16];
                        }
                        double *_gx = gx + n * 1296;
                        double xjxi = rjri[n];
                        double Rpa = xjxi * aj_aij;
                        double c0x = Rpa - rt_aij * Rpq[n*16];
                        s0 = _gx[0];
                        s1 = c0x * s0;
                        _gx[16] = s1;
                        s2 = c0x * s1 + 1 * b10 * s0;
                        _gx[32] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 2 * b10 * s0;
                        _gx[48] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = c0x * s1 + 3 * b10 * s0;
                        _gx[64] = s2;
                        double xlxk = rlrk[n*16];
                        double Rqc = xlxk * al_akl;
                        double cpx = Rqc + rt_akl * Rpq[n*16];
                        s0 = _gx[0];
                        s1 = cpx * s0;
                        _gx[144] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        _gx[288] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        _gx[432] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        _gx[576] = s2;
                        s0 = _gx[16];
                        s1 = cpx * s0;
                        s1 += 1 * b00 * _gx[0];
                        _gx[160] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 1 * b00 * _gx[144];
                        _gx[304] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 1 * b00 * _gx[288];
                        _gx[448] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 1 * b00 * _gx[432];
                        _gx[592] = s2;
                        s0 = _gx[32];
                        s1 = cpx * s0;
                        s1 += 2 * b00 * _gx[16];
                        _gx[176] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 2 * b00 * _gx[160];
                        _gx[320] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 2 * b00 * _gx[304];
                        _gx[464] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 2 * b00 * _gx[448];
                        _gx[608] = s2;
                        s0 = _gx[48];
                        s1 = cpx * s0;
                        s1 += 3 * b00 * _gx[32];
                        _gx[192] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 3 * b00 * _gx[176];
                        _gx[336] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 3 * b00 * _gx[320];
                        _gx[480] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 3 * b00 * _gx[464];
                        _gx[624] = s2;
                        s0 = _gx[64];
                        s1 = cpx * s0;
                        s1 += 4 * b00 * _gx[48];
                        _gx[208] = s1;
                        s2 = cpx*s1 + 1 * b01 *s0;
                        s2 += 4 * b00 * _gx[192];
                        _gx[352] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 2 * b01 *s0;
                        s2 += 4 * b00 * _gx[336];
                        _gx[496] = s2;
                        s0 = s1;
                        s1 = s2;
                        s2 = cpx*s1 + 3 * b01 *s0;
                        s2 += 4 * b00 * _gx[480];
                        _gx[640] = s2;
                        s1 = _gx[64];
                        s0 = _gx[48];
                        _gx[96] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[80] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[16];
                        _gx[64] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[48] = s1 - xjxi * s0;
                        s1 = _gx[96];
                        s0 = _gx[80];
                        _gx[128] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[112] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[48];
                        _gx[96] = s1 - xjxi * s0;
                        s1 = _gx[208];
                        s0 = _gx[192];
                        _gx[240] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[176];
                        _gx[224] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[160];
                        _gx[208] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[144];
                        _gx[192] = s1 - xjxi * s0;
                        s1 = _gx[240];
                        s0 = _gx[224];
                        _gx[272] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[208];
                        _gx[256] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[240] = s1 - xjxi * s0;
                        s1 = _gx[352];
                        s0 = _gx[336];
                        _gx[384] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[368] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[304];
                        _gx[352] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[336] = s1 - xjxi * s0;
                        s1 = _gx[384];
                        s0 = _gx[368];
                        _gx[416] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[400] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[336];
                        _gx[384] = s1 - xjxi * s0;
                        s1 = _gx[496];
                        s0 = _gx[480];
                        _gx[528] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[464];
                        _gx[512] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[448];
                        _gx[496] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[432];
                        _gx[480] = s1 - xjxi * s0;
                        s1 = _gx[528];
                        s0 = _gx[512];
                        _gx[560] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[496];
                        _gx[544] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[480];
                        _gx[528] = s1 - xjxi * s0;
                        s1 = _gx[640];
                        s0 = _gx[624];
                        _gx[672] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[656] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[592];
                        _gx[640] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[624] = s1 - xjxi * s0;
                        s1 = _gx[672];
                        s0 = _gx[656];
                        _gx[704] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[640];
                        _gx[688] = s1 - xjxi * s0;
                        s1 = s0;
                        s0 = _gx[624];
                        _gx[672] = s1 - xjxi * s0;
                        s1 = _gx[576];
                        s0 = _gx[432];
                        _gx[864] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[288];
                        _gx[720] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[144];
                        _gx[576] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[0];
                        _gx[432] = s1 - xlxk * s0;
                        s1 = _gx[864];
                        s0 = _gx[720];
                        _gx[1152] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[576];
                        _gx[1008] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[432];
                        _gx[864] = s1 - xlxk * s0;
                        s1 = _gx[592];
                        s0 = _gx[448];
                        _gx[880] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[304];
                        _gx[736] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[160];
                        _gx[592] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[16];
                        _gx[448] = s1 - xlxk * s0;
                        s1 = _gx[880];
                        s0 = _gx[736];
                        _gx[1168] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[592];
                        _gx[1024] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[448];
                        _gx[880] = s1 - xlxk * s0;
                        s1 = _gx[608];
                        s0 = _gx[464];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[320];
                        _gx[752] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[176];
                        _gx[608] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[32];
                        _gx[464] = s1 - xlxk * s0;
                        s1 = _gx[896];
                        s0 = _gx[752];
                        _gx[1184] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[608];
                        _gx[1040] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[464];
                        _gx[896] = s1 - xlxk * s0;
                        s1 = _gx[624];
                        s0 = _gx[480];
                        _gx[912] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[336];
                        _gx[768] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[192];
                        _gx[624] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[48];
                        _gx[480] = s1 - xlxk * s0;
                        s1 = _gx[912];
                        s0 = _gx[768];
                        _gx[1200] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[624];
                        _gx[1056] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[480];
                        _gx[912] = s1 - xlxk * s0;
                        s1 = _gx[640];
                        s0 = _gx[496];
                        _gx[928] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[352];
                        _gx[784] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[208];
                        _gx[640] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[64];
                        _gx[496] = s1 - xlxk * s0;
                        s1 = _gx[928];
                        s0 = _gx[784];
                        _gx[1216] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[640];
                        _gx[1072] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[496];
                        _gx[928] = s1 - xlxk * s0;
                        s1 = _gx[656];
                        s0 = _gx[512];
                        _gx[944] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[368];
                        _gx[800] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[224];
                        _gx[656] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[80];
                        _gx[512] = s1 - xlxk * s0;
                        s1 = _gx[944];
                        s0 = _gx[800];
                        _gx[1232] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[656];
                        _gx[1088] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[512];
                        _gx[944] = s1 - xlxk * s0;
                        s1 = _gx[672];
                        s0 = _gx[528];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[384];
                        _gx[816] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[240];
                        _gx[672] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[96];
                        _gx[528] = s1 - xlxk * s0;
                        s1 = _gx[960];
                        s0 = _gx[816];
                        _gx[1248] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[672];
                        _gx[1104] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[528];
                        _gx[960] = s1 - xlxk * s0;
                        s1 = _gx[688];
                        s0 = _gx[544];
                        _gx[976] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[400];
                        _gx[832] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[256];
                        _gx[688] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[112];
                        _gx[544] = s1 - xlxk * s0;
                        s1 = _gx[976];
                        s0 = _gx[832];
                        _gx[1264] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[688];
                        _gx[1120] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[544];
                        _gx[976] = s1 - xlxk * s0;
                        s1 = _gx[704];
                        s0 = _gx[560];
                        _gx[992] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[416];
                        _gx[848] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[272];
                        _gx[704] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[128];
                        _gx[560] = s1 - xlxk * s0;
                        s1 = _gx[992];
                        s0 = _gx[848];
                        _gx[1280] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[704];
                        _gx[1136] = s1 - xlxk * s0;
                        s1 = s0;
                        s0 = _gx[560];
                        _gx[992] = s1 - xlxk * s0;
                    }
                    __syncthreads();
                    switch (gout_id) {
                    case 0:
                    dd = dd_cache[0];
                    Ix = gx[640];
                    Iy = gx[1296];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[688] - 1 * gx[592];
                    f2x = ai2 * gx[656] - 1 * gx[624];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1072] - 1 * gx[208];
                    f2x = ak2 * gx[784] - 1 * gx[496];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[704] + gx[656] * xjxi) - 3 * gx[640]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[704] - gx[688] * xjxi) - 3 * gx[640]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1216] - gx[1072] * xlxk) - 3 * gx[640]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1216] + gx[784] * xlxk) - 3 * gx[640]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[704] - 1 * gx[672]) - 1 * (ai2 * gx[608] - 1 * gx[576])) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1216] - 1 * gx[928]) - 1 * (ak2 * gx[352] - 1 * gx[64])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[256];
                    Ix = gx[432];
                    Iy = gx[1456];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1504];
                    f2y = ai2 * gx[1472] - 1 * gx[1440];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1888];
                    f2y = ak2 * gx[1600] - 1 * gx[1312];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1520] + gx[1472] * yjyi) - 3 * gx[1456]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1552] - 1 * gx[1456]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2320] - 1 * gx[1456]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2032] + gx[1600] * ylyk) - 3 * gx[1456]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[512];
                    Ix = gx[144];
                    Iy = gx[1776];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1824] - 1 * gx[1728];
                    f2y = ai2 * gx[1792];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[2208] - 1 * gx[1344];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1840] - gx[1824] * yjyi) - 3 * gx[1776]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2352] - gx[2208] * ylyk) - 3 * gx[1776]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1840] - 1 * ai2 * gx[1744]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2352] - 1 * ak2 * gx[1488]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[768];
                    Ix = gx[16];
                    Iy = gx[1776];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1824] - 1 * gx[1728];
                    f2y = ai2 * gx[1792];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[2208] - 1 * gx[1344];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1840] - gx[1824] * yjyi) - 3 * gx[1776]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2352] - gx[2208] * ylyk) - 3 * gx[1776]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1840] - 1 * ai2 * gx[1744]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2352] - 1 * ak2 * gx[1488]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[1024];
                    Ix = gx[48];
                    Iy = gx[1456];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1504];
                    f2y = ai2 * gx[1472] - 1 * gx[1440];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[1888];
                    f2y = ak2 * gx[1600] - 1 * gx[1312];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1520] + gx[1472] * yjyi) - 3 * gx[1456]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1552] - 1 * gx[1456]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2320] - 1 * gx[1456]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2032] + gx[1600] * ylyk) - 3 * gx[1456]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1280];
                    Ix = gx[0];
                    Iy = gx[1296];
                    Iz = gx[3232];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3280] - 1 * gx[3184];
                    f2z = ai2 * gx[3248] - 1 * gx[3216];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3664] - 1 * gx[2800];
                    f2z = ak2 * gx[3376] - 1 * gx[3088];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3296] + gx[3248] * zjzi) - 3 * gx[3232]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3296] - gx[3280] * zjzi) - 3 * gx[3232]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3808] - gx[3664] * zlzk) - 3 * gx[3232]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3808] + gx[3376] * zlzk) - 3 * gx[3232]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[3296] - 1 * gx[3264]) - 1 * (ai2 * gx[3200] - 1 * gx[3168])) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3808] - 1 * gx[3520]) - 1 * (ak2 * gx[2944] - 1 * gx[2656])) * prod_xy;
                    break;
                    case 1:
                    dd = dd_cache[16];
                    Ix = gx[624];
                    Iy = gx[1312];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672] - 1 * gx[576];
                    f2x = ai2 * gx[640];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1056] - 1 * gx[192];
                    f2x = ak2 * gx[768] - 1 * gx[480];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[656] - 1 * gx[624]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[688] - gx[672] * xjxi) - 3 * gx[624]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1200] - gx[1056] * xlxk) - 3 * gx[624]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1200] + gx[768] * xlxk) - 3 * gx[624]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[688] - 1 * ai2 * gx[592]) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1200] - 1 * gx[912]) - 1 * (ak2 * gx[336] - 1 * gx[48])) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[272];
                    Ix = gx[432];
                    Iy = gx[1440];
                    Iz = gx[2656];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[2704] - 1 * gx[2608];
                    f2z = ai2 * gx[2672] - 1 * gx[2640];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3088];
                    f2z = ak2 * gx[2800];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2720] + gx[2672] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2720] - gx[2704] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3520] - 1 * gx[2656]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2944] - 1 * gx[2656]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2720] - 1 * gx[2688]) - 1 * (ai2 * gx[2624] - 1 * gx[2592])) * prod_xy;
                    v2zz += al2 * ak2 * gx[3232] * prod_xy;
                    dd = dd_cache[528];
                    Ix = gx[160];
                    Iy = gx[1728];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[208];
                    f2x = ai2 * gx[176] - 1 * gx[144];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[592];
                    f2x = ak2 * gx[304] - 1 * gx[16];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[224] + gx[176] * xjxi) - 3 * gx[160]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[256] - 1 * gx[160]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1024] - 1 * gx[160]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[736] + gx[304] * xlxk) - 3 * gx[160]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[784];
                    Ix = gx[0];
                    Iy = gx[1792];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1840] - 1 * gx[1744];
                    f2y = ai2 * gx[1808] - 1 * gx[1776];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2224] - 1 * gx[1360];
                    f2y = ak2 * gx[1936];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1856] + gx[1808] * yjyi) - 3 * gx[1792]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1840] * yjyi) - 3 * gx[1792]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2368] - gx[2224] * ylyk) - 3 * gx[1792]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2080] - 1 * gx[1792]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1856] - 1 * gx[1824]) - 1 * (ai2 * gx[1760] - 1 * gx[1728])) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2368] - 1 * ak2 * gx[1504]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[1040];
                    Ix = gx[48];
                    Iy = gx[1440];
                    Iz = gx[3040];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[3088];
                    f2z = ai2 * gx[3056] - 1 * gx[3024];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3472] - 1 * gx[2608];
                    f2z = ak2 * gx[3184];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3104] + gx[3056] * zjzi) - 3 * gx[3040]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3136] - 1 * gx[3040]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3616] - gx[3472] * zlzk) - 3 * gx[3040]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3616] - 1 * ak2 * gx[2752]) * prod_xy;
                    break;
                    case 2:
                    dd = dd_cache[32];
                    Ix = gx[624];
                    Iy = gx[1296];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[672] - 1 * gx[576];
                    f2x = ai2 * gx[640];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1056] - 1 * gx[192];
                    f2x = ak2 * gx[768] - 1 * gx[480];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[656] - 1 * gx[624]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[688] - gx[672] * xjxi) - 3 * gx[624]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1200] - gx[1056] * xlxk) - 3 * gx[624]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1200] + gx[768] * xlxk) - 3 * gx[624]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[688] - 1 * ai2 * gx[592]) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1200] - 1 * gx[912]) - 1 * (ak2 * gx[336] - 1 * gx[48])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[288];
                    Ix = gx[496];
                    Iy = gx[1296];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[544] - 1 * gx[448];
                    f2x = ai2 * gx[512] - 1 * gx[480];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[928] - 1 * gx[64];
                    f2x = ak2 * gx[640];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[560] + gx[512] * xjxi) - 3 * gx[496]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[560] - gx[544] * xjxi) - 3 * gx[496]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1072] - gx[928] * xlxk) - 3 * gx[496]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[784] - 1 * gx[496]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[560] - 1 * gx[528]) - 1 * (ai2 * gx[464] - 1 * gx[432])) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1072] - 1 * ak2 * gx[208]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[544];
                    Ix = gx[144];
                    Iy = gx[1744];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1792];
                    f2y = ai2 * gx[1760] - 1 * gx[1728];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[2176] - 1 * gx[1312];
                    f2y = ak2 * gx[1888];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1808] + gx[1760] * yjyi) - 3 * gx[1744]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1840] - 1 * gx[1744]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2320] - gx[2176] * ylyk) - 3 * gx[1744]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2320] - 1 * ak2 * gx[1456]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[800];
                    Ix = gx[0];
                    Iy = gx[1776];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1824] - 1 * gx[1728];
                    f2y = ai2 * gx[1792];
                    f1z = aj2 * gx[2800];
                    f2z = ai2 * gx[2768] - 1 * gx[2736];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2208] - 1 * gx[1344];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[3184];
                    f2z = ak2 * gx[2896] - 1 * gx[2608];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1840] - gx[1824] * yjyi) - 3 * gx[1776]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2352] - gx[2208] * ylyk) - 3 * gx[1776]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2816] + gx[2768] * zjzi) - 3 * gx[2752]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2848] - 1 * gx[2752]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3616] - 1 * gx[2752]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3328] + gx[2896] * zlzk) - 3 * gx[2752]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1840] - 1 * ai2 * gx[1744]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2352] - 1 * ak2 * gx[1488]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    dd = dd_cache[1056];
                    Ix = gx[16];
                    Iy = gx[1488];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1536] - 1 * gx[1440];
                    f2y = ai2 * gx[1504];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[1920];
                    f2y = ak2 * gx[1632] - 1 * gx[1344];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1552] - gx[1536] * yjyi) - 3 * gx[1488]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2352] - 1 * gx[1488]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2064] + gx[1632] * ylyk) - 3 * gx[1488]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1552] - 1 * ai2 * gx[1456]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    break;
                    case 3:
                    dd = dd_cache[48];
                    Ix = gx[592];
                    Iy = gx[1344];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[640];
                    f2x = ai2 * gx[608] - 1 * gx[576];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1024] - 1 * gx[160];
                    f2x = ak2 * gx[736] - 1 * gx[448];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[656] + gx[608] * xjxi) - 3 * gx[592]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[688] - 1 * gx[592]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1168] - gx[1024] * xlxk) - 3 * gx[592]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1168] + gx[736] * xlxk) - 3 * gx[592]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[656] - 1 * gx[624]) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1168] - 1 * gx[880]) - 1 * (ak2 * gx[304] - 1 * gx[16])) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[304];
                    Ix = gx[480];
                    Iy = gx[1312];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[528] - 1 * gx[432];
                    f2x = ai2 * gx[496];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[912] - 1 * gx[48];
                    f2x = ak2 * gx[624];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[544] - gx[528] * xjxi) - 3 * gx[480]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1056] - gx[912] * xlxk) - 3 * gx[480]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[544] - 1 * ai2 * gx[448]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1056] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[560];
                    Ix = gx[144];
                    Iy = gx[1728];
                    Iz = gx[2656];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2704] - 1 * gx[2608];
                    f2z = ai2 * gx[2672] - 1 * gx[2640];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3088];
                    f2z = ak2 * gx[2800];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2720] + gx[2672] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2720] - gx[2704] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3520] - 1 * gx[2656]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2944] - 1 * gx[2656]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2720] - 1 * gx[2688]) - 1 * (ai2 * gx[2624] - 1 * gx[2592])) * prod_xy;
                    v2zz += al2 * ak2 * gx[3232] * prod_xy;
                    dd = dd_cache[816];
                    Ix = gx[16];
                    Iy = gx[1728];
                    Iz = gx[2784];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2832] - 1 * gx[2736];
                    f2z = ai2 * gx[2800];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3216];
                    f2z = ak2 * gx[2928] - 1 * gx[2640];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2848] - gx[2832] * zjzi) - 3 * gx[2784]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3648] - 1 * gx[2784]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3360] + gx[2928] * zlzk) - 3 * gx[2784]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2848] - 1 * ai2 * gx[2752]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    dd = dd_cache[1072];
                    Ix = gx[0];
                    Iy = gx[1504];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1552] - 1 * gx[1456];
                    f2y = ai2 * gx[1520] - 1 * gx[1488];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1936];
                    f2y = ak2 * gx[1648] - 1 * gx[1360];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1568] + gx[1520] * yjyi) - 3 * gx[1504]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1568] - gx[1552] * yjyi) - 3 * gx[1504]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2368] - 1 * gx[1504]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2080] + gx[1648] * ylyk) - 3 * gx[1504]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1568] - 1 * gx[1536]) - 1 * (ai2 * gx[1472] - 1 * gx[1440])) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2080] - 1 * gx[1792]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    break;
                    case 4:
                    dd = dd_cache[64];
                    Ix = gx[576];
                    Iy = gx[1360];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[624];
                    f2x = ai2 * gx[592];
                    f1y = aj2 * gx[1408] - 1 * gx[1312];
                    f2y = ai2 * gx[1376] - 1 * gx[1344];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1008] - 1 * gx[144];
                    f2x = ak2 * gx[720] - 1 * gx[432];
                    f1y = al2 * gx[1792];
                    f2y = ak2 * gx[1504];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[608] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[672] - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[1008] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1152] + gx[720] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1424] + gx[1376] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1424] - gx[1408] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2224] - 1 * gx[1360]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1648] - 1 * gx[1360]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[640] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1152] - 1 * gx[864]) - 1 * (ak2 * gx[288] - 1 * gx[0])) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1424] - 1 * gx[1392]) - 1 * (ai2 * gx[1328] - 1 * gx[1296])) * prod_xz;
                    v2yy += al2 * ak2 * gx[1936] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[320];
                    Ix = gx[480];
                    Iy = gx[1296];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[528] - 1 * gx[432];
                    f2x = ai2 * gx[496];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2800];
                    f2z = ai2 * gx[2768] - 1 * gx[2736];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[912] - 1 * gx[48];
                    f2x = ak2 * gx[624];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3184];
                    f2z = ak2 * gx[2896] - 1 * gx[2608];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[544] - gx[528] * xjxi) - 3 * gx[480]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1056] - gx[912] * xlxk) - 3 * gx[480]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2816] + gx[2768] * zjzi) - 3 * gx[2752]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2848] - 1 * gx[2752]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3616] - 1 * gx[2752]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3328] + gx[2896] * zlzk) - 3 * gx[2752]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[544] - 1 * ai2 * gx[448]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1056] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    dd = dd_cache[576];
                    Ix = gx[64];
                    Iy = gx[1872];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[112] - 1 * gx[16];
                    f2x = ai2 * gx[80] - 1 * gx[48];
                    f1y = aj2 * gx[1920];
                    f2y = ai2 * gx[1888];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[496];
                    f2x = ak2 * gx[208];
                    f1y = al2 * gx[2304] - 1 * gx[1440];
                    f2y = ak2 * gx[2016] - 1 * gx[1728];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[128] + gx[80] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[112] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[928] - 1 * gx[64]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[352] - 1 * gx[64]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1904] - 1 * gx[1872]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1968] - 1 * gx[1872]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2448] - gx[2304] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2448] + gx[2016] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[128] - 1 * gx[96]) - 1 * (ai2 * gx[32] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[640] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1936] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2448] - 1 * gx[2160]) - 1 * (ak2 * gx[1584] - 1 * gx[1296])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[832];
                    Ix = gx[0];
                    Iy = gx[1744];
                    Iz = gx[2784];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1792];
                    f2y = ai2 * gx[1760] - 1 * gx[1728];
                    f1z = aj2 * gx[2832] - 1 * gx[2736];
                    f2z = ai2 * gx[2800];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2176] - 1 * gx[1312];
                    f2y = ak2 * gx[1888];
                    f1z = al2 * gx[3216];
                    f2z = ak2 * gx[2928] - 1 * gx[2640];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1808] + gx[1760] * yjyi) - 3 * gx[1744]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1840] - 1 * gx[1744]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2320] - gx[2176] * ylyk) - 3 * gx[1744]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2848] - gx[2832] * zjzi) - 3 * gx[2784]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3648] - 1 * gx[2784]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3360] + gx[2928] * zlzk) - 3 * gx[2784]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2320] - 1 * ak2 * gx[1456]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2848] - 1 * ai2 * gx[2752]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    dd = dd_cache[1088];
                    Ix = gx[0];
                    Iy = gx[1488];
                    Iz = gx[3040];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1536] - 1 * gx[1440];
                    f2y = ai2 * gx[1504];
                    f1z = aj2 * gx[3088];
                    f2z = ai2 * gx[3056] - 1 * gx[3024];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1920];
                    f2y = ak2 * gx[1632] - 1 * gx[1344];
                    f1z = al2 * gx[3472] - 1 * gx[2608];
                    f2z = ak2 * gx[3184];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1552] - gx[1536] * yjyi) - 3 * gx[1488]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2352] - 1 * gx[1488]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2064] + gx[1632] * ylyk) - 3 * gx[1488]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3104] + gx[3056] * zjzi) - 3 * gx[3040]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3136] - 1 * gx[3040]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3616] - gx[3472] * zlzk) - 3 * gx[3040]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1552] - 1 * ai2 * gx[1456]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3616] - 1 * ak2 * gx[2752]) * prod_xy;
                    break;
                    case 5:
                    dd = dd_cache[80];
                    Ix = gx[576];
                    Iy = gx[1344];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[624];
                    f2x = ai2 * gx[592];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1008] - 1 * gx[144];
                    f2x = ak2 * gx[720] - 1 * gx[432];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[608] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[672] - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[1008] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1152] + gx[720] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[640] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1152] - 1 * gx[864]) - 1 * (ak2 * gx[288] - 1 * gx[0])) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[336];
                    Ix = gx[448];
                    Iy = gx[1344];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[496];
                    f2x = ai2 * gx[464] - 1 * gx[432];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[880] - 1 * gx[16];
                    f2x = ak2 * gx[592];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[512] + gx[464] * xjxi) - 3 * gx[448]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[544] - 1 * gx[448]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1024] - gx[880] * xlxk) - 3 * gx[448]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1024] - 1 * ak2 * gx[160]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[592];
                    Ix = gx[48];
                    Iy = gx[1888];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1936];
                    f2y = ai2 * gx[1904] - 1 * gx[1872];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2320] - 1 * gx[1456];
                    f2y = ak2 * gx[2032] - 1 * gx[1744];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1952] + gx[1904] * yjyi) - 3 * gx[1888]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1984] - 1 * gx[1888]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2464] - gx[2320] * ylyk) - 3 * gx[1888]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2464] + gx[2032] * ylyk) - 3 * gx[1888]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1952] - 1 * gx[1920]) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2464] - 1 * gx[2176]) - 1 * (ak2 * gx[1600] - 1 * gx[1312])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[848];
                    Ix = gx[0];
                    Iy = gx[1728];
                    Iz = gx[2800];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2848] - 1 * gx[2752];
                    f2z = ai2 * gx[2816] - 1 * gx[2784];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3232];
                    f2z = ak2 * gx[2944] - 1 * gx[2656];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2864] + gx[2816] * zjzi) - 3 * gx[2800]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2864] - gx[2848] * zjzi) - 3 * gx[2800]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3664] - 1 * gx[2800]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3376] + gx[2944] * zlzk) - 3 * gx[2800]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2864] - 1 * gx[2832]) - 1 * (ai2 * gx[2768] - 1 * gx[2736])) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3376] - 1 * gx[3088]) * prod_xy;
                    dd = dd_cache[1104];
                    Ix = gx[16];
                    Iy = gx[1440];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[3120] - 1 * gx[3024];
                    f2z = ai2 * gx[3088];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3504] - 1 * gx[2640];
                    f2z = ak2 * gx[3216];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3136] - gx[3120] * zjzi) - 3 * gx[3072]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3648] - gx[3504] * zlzk) - 3 * gx[3072]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3136] - 1 * ai2 * gx[3040]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3648] - 1 * ak2 * gx[2784]) * prod_xy;
                    break;
                    case 6:
                    dd = dd_cache[96];
                    Ix = gx[592];
                    Iy = gx[1296];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[640];
                    f2x = ai2 * gx[608] - 1 * gx[576];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1024] - 1 * gx[160];
                    f2x = ak2 * gx[736] - 1 * gx[448];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[656] + gx[608] * xjxi) - 3 * gx[592]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[688] - 1 * gx[592]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1168] - gx[1024] * xlxk) - 3 * gx[592]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1168] + gx[736] * xlxk) - 3 * gx[592]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[656] - 1 * gx[624]) * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1168] - 1 * gx[880]) - 1 * (ak2 * gx[304] - 1 * gx[16])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[352];
                    Ix = gx[432];
                    Iy = gx[1360];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1408] - 1 * gx[1312];
                    f2y = ai2 * gx[1376] - 1 * gx[1344];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1792];
                    f2y = ak2 * gx[1504];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1424] + gx[1376] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1424] - gx[1408] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2224] - 1 * gx[1360]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1648] - 1 * gx[1360]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1424] - 1 * gx[1392]) - 1 * (ai2 * gx[1328] - 1 * gx[1296])) * prod_xz;
                    v2yy += al2 * ak2 * gx[1936] * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[608];
                    Ix = gx[48];
                    Iy = gx[1872];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1920];
                    f2y = ai2 * gx[1888];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2304] - 1 * gx[1440];
                    f2y = ak2 * gx[2016] - 1 * gx[1728];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1904] - 1 * gx[1872]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1968] - 1 * gx[1872]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2448] - gx[2304] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2448] + gx[2016] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1936] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2448] - 1 * gx[2160]) - 1 * (ak2 * gx[1584] - 1 * gx[1296])) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[864];
                    Ix = gx[208];
                    Iy = gx[1296];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[256] - 1 * gx[160];
                    f2x = ai2 * gx[224] - 1 * gx[192];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[640];
                    f2x = ak2 * gx[352] - 1 * gx[64];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[272] + gx[224] * xjxi) - 3 * gx[208]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[272] - gx[256] * xjxi) - 3 * gx[208]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1072] - 1 * gx[208]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[784] + gx[352] * xlxk) - 3 * gx[208]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[272] - 1 * gx[240]) - 1 * (ai2 * gx[176] - 1 * gx[144])) * prod_yz;
                    v2xx += al2 * (ak2 * gx[784] - 1 * gx[496]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1120];
                    Ix = gx[0];
                    Iy = gx[1456];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1504];
                    f2y = ai2 * gx[1472] - 1 * gx[1440];
                    f1z = aj2 * gx[3120] - 1 * gx[3024];
                    f2z = ai2 * gx[3088];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1888];
                    f2y = ak2 * gx[1600] - 1 * gx[1312];
                    f1z = al2 * gx[3504] - 1 * gx[2640];
                    f2z = ak2 * gx[3216];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1520] + gx[1472] * yjyi) - 3 * gx[1456]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1552] - 1 * gx[1456]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2320] - 1 * gx[1456]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2032] + gx[1600] * ylyk) - 3 * gx[1456]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3136] - gx[3120] * zjzi) - 3 * gx[3072]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3648] - gx[3504] * zlzk) - 3 * gx[3072]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3136] - 1 * ai2 * gx[3040]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3648] - 1 * ak2 * gx[2784]) * prod_xy;
                    break;
                    case 7:
                    dd = dd_cache[112];
                    Ix = gx[576];
                    Iy = gx[1312];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[624];
                    f2x = ai2 * gx[592];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1008] - 1 * gx[144];
                    f2x = ak2 * gx[720] - 1 * gx[432];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[608] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[672] - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[1008] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1152] + gx[720] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[640] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1152] - 1 * gx[864]) - 1 * (ak2 * gx[288] - 1 * gx[0])) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[368];
                    Ix = gx[432];
                    Iy = gx[1344];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[2800];
                    f2z = ai2 * gx[2768] - 1 * gx[2736];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3184];
                    f2z = ak2 * gx[2896] - 1 * gx[2608];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2816] + gx[2768] * zjzi) - 3 * gx[2752]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2848] - 1 * gx[2752]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3616] - 1 * gx[2752]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3328] + gx[2896] * zlzk) - 3 * gx[2752]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    dd = dd_cache[624];
                    Ix = gx[16];
                    Iy = gx[1920];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1968] - 1 * gx[1872];
                    f2y = ai2 * gx[1936];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[2352] - 1 * gx[1488];
                    f2y = ak2 * gx[2064] - 1 * gx[1776];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1952] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1984] - gx[1968] * yjyi) - 3 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2496] - gx[2352] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2496] + gx[2064] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1984] - 1 * ai2 * gx[1888]) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2496] - 1 * gx[2208]) - 1 * (ak2 * gx[1632] - 1 * gx[1344])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[880];
                    Ix = gx[192];
                    Iy = gx[1312];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[240] - 1 * gx[144];
                    f2x = ai2 * gx[208];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[624];
                    f2x = ak2 * gx[336] - 1 * gx[48];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[240] * xjxi) - 3 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1056] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[768] + gx[336] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[256] - 1 * ai2 * gx[160]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1136];
                    Ix = gx[0];
                    Iy = gx[1440];
                    Iz = gx[3088];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[3136] - 1 * gx[3040];
                    f2z = ai2 * gx[3104] - 1 * gx[3072];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3520] - 1 * gx[2656];
                    f2z = ak2 * gx[3232];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3152] + gx[3104] * zjzi) - 3 * gx[3088]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3152] - gx[3136] * zjzi) - 3 * gx[3088]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3664] - gx[3520] * zlzk) - 3 * gx[3088]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3376] - 1 * gx[3088]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[3152] - 1 * gx[3120]) - 1 * (ai2 * gx[3056] - 1 * gx[3024])) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3664] - 1 * ak2 * gx[2800]) * prod_xy;
                    break;
                    case 8:
                    dd = dd_cache[128];
                    Ix = gx[576];
                    Iy = gx[1296];
                    Iz = gx[2656];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[624];
                    f2x = ai2 * gx[592];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2704] - 1 * gx[2608];
                    f2z = ai2 * gx[2672] - 1 * gx[2640];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[1008] - 1 * gx[144];
                    f2x = ak2 * gx[720] - 1 * gx[432];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3088];
                    f2z = ak2 * gx[2800];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[608] - 1 * gx[576]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[672] - 1 * gx[576]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1152] - gx[1008] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[1152] + gx[720] * xlxk) - 3 * gx[576]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2720] + gx[2672] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2720] - gx[2704] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3520] - 1 * gx[2656]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2944] - 1 * gx[2656]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[640] * prod_yz;
                    v2xx += (al2 * (ak2 * gx[1152] - 1 * gx[864]) - 1 * (ak2 * gx[288] - 1 * gx[0])) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2720] - 1 * gx[2688]) - 1 * (ai2 * gx[2624] - 1 * gx[2592])) * prod_xy;
                    v2zz += al2 * ak2 * gx[3232] * prod_xy;
                    dd = dd_cache[384];
                    Ix = gx[448];
                    Iy = gx[1296];
                    Iz = gx[2784];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[496];
                    f2x = ai2 * gx[464] - 1 * gx[432];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2832] - 1 * gx[2736];
                    f2z = ai2 * gx[2800];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[880] - 1 * gx[16];
                    f2x = ak2 * gx[592];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3216];
                    f2z = ak2 * gx[2928] - 1 * gx[2640];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[512] + gx[464] * xjxi) - 3 * gx[448]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[544] - 1 * gx[448]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1024] - gx[880] * xlxk) - 3 * gx[448]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2848] - gx[2832] * zjzi) - 3 * gx[2784]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3648] - 1 * gx[2784]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3360] + gx[2928] * zlzk) - 3 * gx[2784]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1024] - 1 * ak2 * gx[160]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2848] - 1 * ai2 * gx[2752]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    dd = dd_cache[640];
                    Ix = gx[0];
                    Iy = gx[1936];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1984] - 1 * gx[1888];
                    f2y = ai2 * gx[1952] - 1 * gx[1920];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2368] - 1 * gx[1504];
                    f2y = ak2 * gx[2080] - 1 * gx[1792];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[2000] + gx[1952] * yjyi) - 3 * gx[1936]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[2000] - gx[1984] * yjyi) - 3 * gx[1936]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2512] - gx[2368] * ylyk) - 3 * gx[1936]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2512] + gx[2080] * ylyk) - 3 * gx[1936]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[2000] - 1 * gx[1968]) - 1 * (ai2 * gx[1904] - 1 * gx[1872])) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2512] - 1 * gx[2224]) - 1 * (ak2 * gx[1648] - 1 * gx[1360])) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[896];
                    Ix = gx[192];
                    Iy = gx[1296];
                    Iz = gx[3040];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[240] - 1 * gx[144];
                    f2x = ai2 * gx[208];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3088];
                    f2z = ai2 * gx[3056] - 1 * gx[3024];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[624];
                    f2x = ak2 * gx[336] - 1 * gx[48];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3472] - 1 * gx[2608];
                    f2z = ak2 * gx[3184];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[240] * xjxi) - 3 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1056] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[768] + gx[336] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3104] + gx[3056] * zjzi) - 3 * gx[3040]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3136] - 1 * gx[3040]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3616] - gx[3472] * zlzk) - 3 * gx[3040]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[256] - 1 * ai2 * gx[160]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3616] - 1 * ak2 * gx[2752]) * prod_xy;
                    dd = dd_cache[1152];
                    Ix = gx[64];
                    Iy = gx[1296];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[112] - 1 * gx[16];
                    f2x = ai2 * gx[80] - 1 * gx[48];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3216];
                    f2z = ai2 * gx[3184];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[496];
                    f2x = ak2 * gx[208];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3600] - 1 * gx[2736];
                    f2z = ak2 * gx[3312] - 1 * gx[3024];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[128] + gx[80] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[112] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[928] - 1 * gx[64]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[352] - 1 * gx[64]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3200] - 1 * gx[3168]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3264] - 1 * gx[3168]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3744] - gx[3600] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3744] + gx[3312] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[128] - 1 * gx[96]) - 1 * (ai2 * gx[32] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[640] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3232] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3744] - 1 * gx[3456]) - 1 * (ak2 * gx[2880] - 1 * gx[2592])) * prod_xy;
                    break;
                    case 9:
                    dd = dd_cache[144];
                    Ix = gx[496];
                    Iy = gx[1440];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[544] - 1 * gx[448];
                    f2x = ai2 * gx[512] - 1 * gx[480];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[928] - 1 * gx[64];
                    f2x = ak2 * gx[640];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[560] + gx[512] * xjxi) - 3 * gx[496]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[560] - gx[544] * xjxi) - 3 * gx[496]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1072] - gx[928] * xlxk) - 3 * gx[496]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[784] - 1 * gx[496]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[560] - 1 * gx[528]) - 1 * (ai2 * gx[464] - 1 * gx[432])) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1072] - 1 * ak2 * gx[208]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[400];
                    Ix = gx[432];
                    Iy = gx[1312];
                    Iz = gx[2784];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[2832] - 1 * gx[2736];
                    f2z = ai2 * gx[2800];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3216];
                    f2z = ak2 * gx[2928] - 1 * gx[2640];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2848] - gx[2832] * zjzi) - 3 * gx[2784]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3648] - 1 * gx[2784]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3360] + gx[2928] * zlzk) - 3 * gx[2784]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2848] - 1 * ai2 * gx[2752]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    dd = dd_cache[656];
                    Ix = gx[0];
                    Iy = gx[1920];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1968] - 1 * gx[1872];
                    f2y = ai2 * gx[1936];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2352] - 1 * gx[1488];
                    f2y = ak2 * gx[2064] - 1 * gx[1776];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1952] - 1 * gx[1920]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1984] - gx[1968] * yjyi) - 3 * gx[1920]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2496] - gx[2352] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2496] + gx[2064] * ylyk) - 3 * gx[1920]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1984] - 1 * ai2 * gx[1888]) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2496] - 1 * gx[2208]) - 1 * (ak2 * gx[1632] - 1 * gx[1344])) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[912];
                    Ix = gx[160];
                    Iy = gx[1344];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[208];
                    f2x = ai2 * gx[176] - 1 * gx[144];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[592];
                    f2x = ak2 * gx[304] - 1 * gx[16];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[224] + gx[176] * xjxi) - 3 * gx[160]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[256] - 1 * gx[160]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1024] - 1 * gx[160]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[736] + gx[304] * xlxk) - 3 * gx[160]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1168];
                    Ix = gx[48];
                    Iy = gx[1312];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[3216];
                    f2z = ai2 * gx[3184];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3600] - 1 * gx[2736];
                    f2z = ak2 * gx[3312] - 1 * gx[3024];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3200] - 1 * gx[3168]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3264] - 1 * gx[3168]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3744] - gx[3600] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3744] + gx[3312] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3232] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3744] - 1 * gx[3456]) - 1 * (ak2 * gx[2880] - 1 * gx[2592])) * prod_xy;
                    break;
                    case 10:
                    dd = dd_cache[160];
                    Ix = gx[480];
                    Iy = gx[1456];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[528] - 1 * gx[432];
                    f2x = ai2 * gx[496];
                    f1y = aj2 * gx[1504];
                    f2y = ai2 * gx[1472] - 1 * gx[1440];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[912] - 1 * gx[48];
                    f2x = ak2 * gx[624];
                    f1y = al2 * gx[1888];
                    f2y = ak2 * gx[1600] - 1 * gx[1312];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[544] - gx[528] * xjxi) - 3 * gx[480]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1056] - gx[912] * xlxk) - 3 * gx[480]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1520] + gx[1472] * yjyi) - 3 * gx[1456]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1552] - 1 * gx[1456]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2320] - 1 * gx[1456]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2032] + gx[1600] * ylyk) - 3 * gx[1456]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[544] - 1 * ai2 * gx[448]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1056] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[416];
                    Ix = gx[432];
                    Iy = gx[1296];
                    Iz = gx[2800];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[2848] - 1 * gx[2752];
                    f2z = ai2 * gx[2816] - 1 * gx[2784];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3232];
                    f2z = ak2 * gx[2944] - 1 * gx[2656];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2864] + gx[2816] * zjzi) - 3 * gx[2800]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2864] - gx[2848] * zjzi) - 3 * gx[2800]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3664] - 1 * gx[2800]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3376] + gx[2944] * zlzk) - 3 * gx[2800]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2864] - 1 * gx[2832]) - 1 * (ai2 * gx[2768] - 1 * gx[2736])) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3376] - 1 * gx[3088]) * prod_xy;
                    dd = dd_cache[672];
                    Ix = gx[16];
                    Iy = gx[1872];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1920];
                    f2y = ai2 * gx[1888];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[2304] - 1 * gx[1440];
                    f2y = ak2 * gx[2016] - 1 * gx[1728];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1904] - 1 * gx[1872]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1968] - 1 * gx[1872]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2448] - gx[2304] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2448] + gx[2016] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1936] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2448] - 1 * gx[2160]) - 1 * (ak2 * gx[1584] - 1 * gx[1296])) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[928];
                    Ix = gx[144];
                    Iy = gx[1360];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1408] - 1 * gx[1312];
                    f2y = ai2 * gx[1376] - 1 * gx[1344];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[1792];
                    f2y = ak2 * gx[1504];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1424] + gx[1376] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1424] - gx[1408] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2224] - 1 * gx[1360]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1648] - 1 * gx[1360]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1424] - 1 * gx[1392]) - 1 * (ai2 * gx[1328] - 1 * gx[1296])) * prod_xz;
                    v2yy += al2 * ak2 * gx[1936] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1184];
                    Ix = gx[48];
                    Iy = gx[1296];
                    Iz = gx[3184];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3232];
                    f2z = ai2 * gx[3200] - 1 * gx[3168];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3616] - 1 * gx[2752];
                    f2z = ak2 * gx[3328] - 1 * gx[3040];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3248] + gx[3200] * zjzi) - 3 * gx[3184]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3280] - 1 * gx[3184]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3760] - gx[3616] * zlzk) - 3 * gx[3184]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3760] + gx[3328] * zlzk) - 3 * gx[3184]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3248] - 1 * gx[3216]) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3760] - 1 * gx[3472]) - 1 * (ak2 * gx[2896] - 1 * gx[2608])) * prod_xy;
                    break;
                    case 11:
                    dd = dd_cache[176];
                    Ix = gx[480];
                    Iy = gx[1440];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[528] - 1 * gx[432];
                    f2x = ai2 * gx[496];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[912] - 1 * gx[48];
                    f2x = ak2 * gx[624];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[544] - gx[528] * xjxi) - 3 * gx[480]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1056] - gx[912] * xlxk) - 3 * gx[480]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[544] - 1 * ai2 * gx[448]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1056] - 1 * ak2 * gx[192]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[432];
                    Ix = gx[208];
                    Iy = gx[1728];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[256] - 1 * gx[160];
                    f2x = ai2 * gx[224] - 1 * gx[192];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[640];
                    f2x = ak2 * gx[352] - 1 * gx[64];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[272] + gx[224] * xjxi) - 3 * gx[208]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[272] - gx[256] * xjxi) - 3 * gx[208]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1072] - 1 * gx[208]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[784] + gx[352] * xlxk) - 3 * gx[208]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[272] - 1 * gx[240]) - 1 * (ai2 * gx[176] - 1 * gx[144])) * prod_yz;
                    v2xx += al2 * (ak2 * gx[784] - 1 * gx[496]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[688];
                    Ix = gx[0];
                    Iy = gx[1888];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1936];
                    f2y = ai2 * gx[1904] - 1 * gx[1872];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2320] - 1 * gx[1456];
                    f2y = ak2 * gx[2032] - 1 * gx[1744];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1952] + gx[1904] * yjyi) - 3 * gx[1888]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1984] - 1 * gx[1888]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2464] - gx[2320] * ylyk) - 3 * gx[1888]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2464] + gx[2032] * ylyk) - 3 * gx[1888]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1952] - 1 * gx[1920]) * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2464] - 1 * gx[2176]) - 1 * (ak2 * gx[1600] - 1 * gx[1312])) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[944];
                    Ix = gx[144];
                    Iy = gx[1344];
                    Iz = gx[3040];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[3088];
                    f2z = ai2 * gx[3056] - 1 * gx[3024];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3472] - 1 * gx[2608];
                    f2z = ak2 * gx[3184];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3104] + gx[3056] * zjzi) - 3 * gx[3040]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3136] - 1 * gx[3040]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3616] - gx[3472] * zlzk) - 3 * gx[3040]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3616] - 1 * ak2 * gx[2752]) * prod_xy;
                    dd = dd_cache[1200];
                    Ix = gx[16];
                    Iy = gx[1344];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[3216];
                    f2z = ai2 * gx[3184];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3600] - 1 * gx[2736];
                    f2z = ak2 * gx[3312] - 1 * gx[3024];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3200] - 1 * gx[3168]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3264] - 1 * gx[3168]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3744] - gx[3600] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3744] + gx[3312] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3232] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3744] - 1 * gx[3456]) - 1 * (ak2 * gx[2880] - 1 * gx[2592])) * prod_xy;
                    break;
                    case 12:
                    dd = dd_cache[192];
                    Ix = gx[448];
                    Iy = gx[1488];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[496];
                    f2x = ai2 * gx[464] - 1 * gx[432];
                    f1y = aj2 * gx[1536] - 1 * gx[1440];
                    f2y = ai2 * gx[1504];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[880] - 1 * gx[16];
                    f2x = ak2 * gx[592];
                    f1y = al2 * gx[1920];
                    f2y = ak2 * gx[1632] - 1 * gx[1344];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[512] + gx[464] * xjxi) - 3 * gx[448]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[544] - 1 * gx[448]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1024] - gx[880] * xlxk) - 3 * gx[448]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1552] - gx[1536] * yjyi) - 3 * gx[1488]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2352] - 1 * gx[1488]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2064] + gx[1632] * ylyk) - 3 * gx[1488]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1024] - 1 * ak2 * gx[160]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1552] - 1 * ai2 * gx[1456]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[448];
                    Ix = gx[192];
                    Iy = gx[1744];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[240] - 1 * gx[144];
                    f2x = ai2 * gx[208];
                    f1y = aj2 * gx[1792];
                    f2y = ai2 * gx[1760] - 1 * gx[1728];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[624];
                    f2x = ak2 * gx[336] - 1 * gx[48];
                    f1y = al2 * gx[2176] - 1 * gx[1312];
                    f2y = ak2 * gx[1888];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[240] * xjxi) - 3 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1056] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[768] + gx[336] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1808] + gx[1760] * yjyi) - 3 * gx[1744]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1840] - 1 * gx[1744]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2320] - gx[2176] * ylyk) - 3 * gx[1744]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[256] - 1 * ai2 * gx[160]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2320] - 1 * ak2 * gx[1456]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[704];
                    Ix = gx[0];
                    Iy = gx[1872];
                    Iz = gx[2656];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1920];
                    f2y = ai2 * gx[1888];
                    f1z = aj2 * gx[2704] - 1 * gx[2608];
                    f2z = ai2 * gx[2672] - 1 * gx[2640];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[2304] - 1 * gx[1440];
                    f2y = ak2 * gx[2016] - 1 * gx[1728];
                    f1z = al2 * gx[3088];
                    f2z = ak2 * gx[2800];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1904] - 1 * gx[1872]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1968] - 1 * gx[1872]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2448] - gx[2304] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2448] + gx[2016] * ylyk) - 3 * gx[1872]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2720] + gx[2672] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2720] - gx[2704] * zjzi) - 3 * gx[2656]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3520] - 1 * gx[2656]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2944] - 1 * gx[2656]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1936] * prod_xz;
                    v2yy += (al2 * (ak2 * gx[2448] - 1 * gx[2160]) - 1 * (ak2 * gx[1584] - 1 * gx[1296])) * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[2720] - 1 * gx[2688]) - 1 * (ai2 * gx[2624] - 1 * gx[2592])) * prod_xy;
                    v2zz += al2 * ak2 * gx[3232] * prod_xy;
                    dd = dd_cache[960];
                    Ix = gx[160];
                    Iy = gx[1296];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[208];
                    f2x = ai2 * gx[176] - 1 * gx[144];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3120] - 1 * gx[3024];
                    f2z = ai2 * gx[3088];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[592];
                    f2x = ak2 * gx[304] - 1 * gx[16];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3504] - 1 * gx[2640];
                    f2z = ak2 * gx[3216];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[224] + gx[176] * xjxi) - 3 * gx[160]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[256] - 1 * gx[160]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1024] - 1 * gx[160]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[736] + gx[304] * xlxk) - 3 * gx[160]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3136] - gx[3120] * zjzi) - 3 * gx[3072]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3648] - gx[3504] * zlzk) - 3 * gx[3072]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3136] - 1 * ai2 * gx[3040]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3648] - 1 * ak2 * gx[2784]) * prod_xy;
                    dd = dd_cache[1216];
                    Ix = gx[0];
                    Iy = gx[1360];
                    Iz = gx[3168];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1408] - 1 * gx[1312];
                    f2y = ai2 * gx[1376] - 1 * gx[1344];
                    f1z = aj2 * gx[3216];
                    f2z = ai2 * gx[3184];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1792];
                    f2y = ak2 * gx[1504];
                    f1z = al2 * gx[3600] - 1 * gx[2736];
                    f2z = ak2 * gx[3312] - 1 * gx[3024];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1424] + gx[1376] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1424] - gx[1408] * yjyi) - 3 * gx[1360]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2224] - 1 * gx[1360]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1648] - 1 * gx[1360]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3200] - 1 * gx[3168]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3264] - 1 * gx[3168]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3744] - gx[3600] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3744] + gx[3312] * zlzk) - 3 * gx[3168]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1424] - 1 * gx[1392]) - 1 * (ai2 * gx[1328] - 1 * gx[1296])) * prod_xz;
                    v2yy += al2 * ak2 * gx[1936] * prod_xz;
                    v1zz += aj2 * ai2 * gx[3232] * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3744] - 1 * gx[3456]) - 1 * (ak2 * gx[2880] - 1 * gx[2592])) * prod_xy;
                    break;
                    case 13:
                    dd = dd_cache[208];
                    Ix = gx[432];
                    Iy = gx[1504];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1552] - 1 * gx[1456];
                    f2y = ai2 * gx[1520] - 1 * gx[1488];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1936];
                    f2y = ak2 * gx[1648] - 1 * gx[1360];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1568] + gx[1520] * yjyi) - 3 * gx[1504]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1568] - gx[1552] * yjyi) - 3 * gx[1504]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2368] - 1 * gx[1504]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2080] + gx[1648] * ylyk) - 3 * gx[1504]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1568] - 1 * gx[1536]) - 1 * (ai2 * gx[1472] - 1 * gx[1440])) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2080] - 1 * gx[1792]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[464];
                    Ix = gx[192];
                    Iy = gx[1728];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[240] - 1 * gx[144];
                    f2x = ai2 * gx[208];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[624];
                    f2x = ak2 * gx[336] - 1 * gx[48];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[256] - gx[240] * xjxi) - 3 * gx[192]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1056] - 1 * gx[192]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[768] + gx[336] * xlxk) - 3 * gx[192]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[256] - 1 * ai2 * gx[160]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[768] - 1 * gx[480]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[720];
                    Ix = gx[64];
                    Iy = gx[1728];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[112] - 1 * gx[16];
                    f2x = ai2 * gx[80] - 1 * gx[48];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[496];
                    f2x = ak2 * gx[208];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[128] + gx[80] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[112] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[928] - 1 * gx[64]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[352] - 1 * gx[64]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[128] - 1 * gx[96]) - 1 * (ai2 * gx[32] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[640] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[976];
                    Ix = gx[144];
                    Iy = gx[1312];
                    Iz = gx[3072];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[3120] - 1 * gx[3024];
                    f2z = ai2 * gx[3088];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3504] - 1 * gx[2640];
                    f2z = ak2 * gx[3216];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3104] - 1 * gx[3072]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3136] - gx[3120] * zjzi) - 3 * gx[3072]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3648] - gx[3504] * zlzk) - 3 * gx[3072]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3360] - 1 * gx[3072]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3136] - 1 * ai2 * gx[3040]) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3648] - 1 * ak2 * gx[2784]) * prod_xy;
                    dd = dd_cache[1232];
                    Ix = gx[0];
                    Iy = gx[1344];
                    Iz = gx[3184];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1392] - 1 * gx[1296];
                    f2y = ai2 * gx[1360];
                    f1z = aj2 * gx[3232];
                    f2z = ai2 * gx[3200] - 1 * gx[3168];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1776];
                    f2y = ak2 * gx[1488];
                    f1z = al2 * gx[3616] - 1 * gx[2752];
                    f2z = ak2 * gx[3328] - 1 * gx[3040];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1408] - gx[1392] * yjyi) - 3 * gx[1344]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2208] - 1 * gx[1344]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1632] - 1 * gx[1344]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3248] + gx[3200] * zjzi) - 3 * gx[3184]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3280] - 1 * gx[3184]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3760] - gx[3616] * zlzk) - 3 * gx[3184]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3760] + gx[3328] * zlzk) - 3 * gx[3184]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1408] - 1 * ai2 * gx[1312]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1920] * prod_xz;
                    v1zz += aj2 * (ai2 * gx[3248] - 1 * gx[3216]) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3760] - 1 * gx[3472]) - 1 * (ak2 * gx[2896] - 1 * gx[2608])) * prod_xy;
                    break;
                    case 14:
                    dd = dd_cache[224];
                    Ix = gx[432];
                    Iy = gx[1488];
                    Iz = gx[2608];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[480];
                    f2x = ai2 * gx[448];
                    f1y = aj2 * gx[1536] - 1 * gx[1440];
                    f2y = ai2 * gx[1504];
                    f1z = aj2 * gx[2656];
                    f2z = ai2 * gx[2624] - 1 * gx[2592];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[864] - 1 * gx[0];
                    f2x = ak2 * gx[576];
                    f1y = al2 * gx[1920];
                    f2y = ak2 * gx[1632] - 1 * gx[1344];
                    f1z = al2 * gx[3040];
                    f2z = ak2 * gx[2752];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[464] - 1 * gx[432]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[528] - 1 * gx[432]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1008] - gx[864] * xlxk) - 3 * gx[432]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1520] - 1 * gx[1488]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1552] - gx[1536] * yjyi) - 3 * gx[1488]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2352] - 1 * gx[1488]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2064] + gx[1632] * ylyk) - 3 * gx[1488]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2672] + gx[2624] * zjzi) - 3 * gx[2608]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2704] - 1 * gx[2608]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3472] - 1 * gx[2608]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2896] - 1 * gx[2608]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[496] * prod_yz;
                    v2xx += (al2 * ak2 * gx[1008] - 1 * ak2 * gx[144]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1552] - 1 * ai2 * gx[1456]) * prod_xz;
                    v2yy += al2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3184] * prod_xy;
                    dd = dd_cache[480];
                    Ix = gx[160];
                    Iy = gx[1776];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[208];
                    f2x = ai2 * gx[176] - 1 * gx[144];
                    f1y = aj2 * gx[1824] - 1 * gx[1728];
                    f2y = ai2 * gx[1792];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[592];
                    f2x = ak2 * gx[304] - 1 * gx[16];
                    f1y = al2 * gx[2208] - 1 * gx[1344];
                    f2y = ak2 * gx[1920];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[224] + gx[176] * xjxi) - 3 * gx[160]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[256] - 1 * gx[160]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1024] - 1 * gx[160]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[736] + gx[304] * xlxk) - 3 * gx[160]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1840] - gx[1824] * yjyi) - 3 * gx[1776]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2352] - gx[2208] * ylyk) - 3 * gx[1776]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2064] - 1 * gx[1776]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[224] - 1 * gx[192]) * prod_yz;
                    v2xx += al2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v1yy += (aj2 * ai2 * gx[1840] - 1 * ai2 * gx[1744]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2352] - 1 * ak2 * gx[1488]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[736];
                    Ix = gx[48];
                    Iy = gx[1744];
                    Iz = gx[2736];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1792];
                    f2y = ai2 * gx[1760] - 1 * gx[1728];
                    f1z = aj2 * gx[2784];
                    f2z = ai2 * gx[2752];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2176] - 1 * gx[1312];
                    f2y = ak2 * gx[1888];
                    f1z = al2 * gx[3168];
                    f2z = ak2 * gx[2880] - 1 * gx[2592];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1808] + gx[1760] * yjyi) - 3 * gx[1744]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1840] - 1 * gx[1744]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2320] - gx[2176] * ylyk) - 3 * gx[1744]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2032] - 1 * gx[1744]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2768] - 1 * gx[2736]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2832] - 1 * gx[2736]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3600] - 1 * gx[2736]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3312] + gx[2880] * zlzk) - 3 * gx[2736]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1808] - 1 * gx[1776]) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2320] - 1 * ak2 * gx[1456]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2800] * prod_xy;
                    v2zz += al2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    dd = dd_cache[992];
                    Ix = gx[144];
                    Iy = gx[1296];
                    Iz = gx[3088];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3136] - 1 * gx[3040];
                    f2z = ai2 * gx[3104] - 1 * gx[3072];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3520] - 1 * gx[2656];
                    f2z = ak2 * gx[3232];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[3152] + gx[3104] * zjzi) - 3 * gx[3088]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3152] - gx[3136] * zjzi) - 3 * gx[3088]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3664] - gx[3520] * zlzk) - 3 * gx[3088]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3376] - 1 * gx[3088]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * (ai2 * gx[3152] - 1 * gx[3120]) - 1 * (ai2 * gx[3056] - 1 * gx[3024])) * prod_xy;
                    v2zz += (al2 * ak2 * gx[3664] - 1 * ak2 * gx[2800]) * prod_xy;
                    dd = dd_cache[1248];
                    Ix = gx[16];
                    Iy = gx[1296];
                    Iz = gx[3216];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[64];
                    f2x = ai2 * gx[32] - 1 * gx[0];
                    f1y = aj2 * gx[1344];
                    f2y = ai2 * gx[1312];
                    f1z = aj2 * gx[3264] - 1 * gx[3168];
                    f2z = ai2 * gx[3232];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[448];
                    f2x = ak2 * gx[160];
                    f1y = al2 * gx[1728];
                    f2y = ak2 * gx[1440];
                    f1z = al2 * gx[3648] - 1 * gx[2784];
                    f2z = ak2 * gx[3360] - 1 * gx[3072];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[80] + gx[32] * xjxi) - 3 * gx[16]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[112] - 1 * gx[16]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[880] - 1 * gx[16]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[304] - 1 * gx[16]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1328] - 1 * gx[1296]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1392] - 1 * gx[1296]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2160] - 1 * gx[1296]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1584] - 1 * gx[1296]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3248] - 1 * gx[3216]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3280] - gx[3264] * zjzi) - 3 * gx[3216]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3792] - gx[3648] * zlzk) - 3 * gx[3216]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3792] + gx[3360] * zlzk) - 3 * gx[3216]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v2xx += al2 * ak2 * gx[592] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1360] * prod_xz;
                    v2yy += al2 * ak2 * gx[1872] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3280] - 1 * ai2 * gx[3184]) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3792] - 1 * gx[3504]) - 1 * (ak2 * gx[2928] - 1 * gx[2640])) * prod_xy;
                    break;
                    case 15:
                    dd = dd_cache[240];
                    Ix = gx[448];
                    Iy = gx[1440];
                    Iz = gx[2640];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[496];
                    f2x = ai2 * gx[464] - 1 * gx[432];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[2688] - 1 * gx[2592];
                    f2z = ai2 * gx[2656];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[880] - 1 * gx[16];
                    f2x = ak2 * gx[592];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3072];
                    f2z = ak2 * gx[2784];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[512] + gx[464] * xjxi) - 3 * gx[448]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[544] - 1 * gx[448]) * prod_yz;
                    v_lxx += al2 * (al2 * (gx[1024] - gx[880] * xlxk) - 3 * gx[448]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[736] - 1 * gx[448]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2672] - 1 * gx[2640]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[2704] - gx[2688] * zjzi) - 3 * gx[2640]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3504] - 1 * gx[2640]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2928] - 1 * gx[2640]) * prod_xy;
                    v1xx += aj2 * (ai2 * gx[512] - 1 * gx[480]) * prod_yz;
                    v2xx += (al2 * ak2 * gx[1024] - 1 * ak2 * gx[160]) * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += (aj2 * ai2 * gx[2704] - 1 * ai2 * gx[2608]) * prod_xy;
                    v2zz += al2 * ak2 * gx[3216] * prod_xy;
                    dd = dd_cache[496];
                    Ix = gx[144];
                    Iy = gx[1792];
                    Iz = gx[2592];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[192];
                    f2x = ai2 * gx[160];
                    f1y = aj2 * gx[1840] - 1 * gx[1744];
                    f2y = ai2 * gx[1808] - 1 * gx[1776];
                    f1z = aj2 * gx[2640];
                    f2z = ai2 * gx[2608];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[576];
                    f2x = ak2 * gx[288] - 1 * gx[0];
                    f1y = al2 * gx[2224] - 1 * gx[1360];
                    f2y = ak2 * gx[1936];
                    f1z = al2 * gx[3024];
                    f2z = ak2 * gx[2736];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[176] - 1 * gx[144]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[240] - 1 * gx[144]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[1008] - 1 * gx[144]) * prod_yz;
                    v_kxx += ak2 * (ak2 * (gx[720] + gx[288] * xlxk) - 3 * gx[144]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1856] + gx[1808] * yjyi) - 3 * gx[1792]) * prod_xz;
                    v_jyy += aj2 * (aj2 * (gx[1856] - gx[1840] * yjyi) - 3 * gx[1792]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2368] - gx[2224] * ylyk) - 3 * gx[1792]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2080] - 1 * gx[1792]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[2624] - 1 * gx[2592]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2688] - 1 * gx[2592]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3456] - 1 * gx[2592]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[2880] - 1 * gx[2592]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[208] * prod_yz;
                    v2xx += al2 * (ak2 * gx[720] - 1 * gx[432]) * prod_yz;
                    v1yy += (aj2 * (ai2 * gx[1856] - 1 * gx[1824]) - 1 * (ai2 * gx[1760] - 1 * gx[1728])) * prod_xz;
                    v2yy += (al2 * ak2 * gx[2368] - 1 * ak2 * gx[1504]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[2656] * prod_xy;
                    v2zz += al2 * ak2 * gx[3168] * prod_xy;
                    dd = dd_cache[752];
                    Ix = gx[48];
                    Iy = gx[1728];
                    Iz = gx[2752];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[96] - 1 * gx[0];
                    f2x = ai2 * gx[64];
                    f1y = aj2 * gx[1776];
                    f2y = ai2 * gx[1744];
                    f1z = aj2 * gx[2800];
                    f2z = ai2 * gx[2768] - 1 * gx[2736];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[480];
                    f2x = ak2 * gx[192];
                    f1y = al2 * gx[2160] - 1 * gx[1296];
                    f2y = ak2 * gx[1872];
                    f1z = al2 * gx[3184];
                    f2z = ak2 * gx[2896] - 1 * gx[2608];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[80] - 1 * gx[48]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[112] - gx[96] * xjxi) - 3 * gx[48]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[912] - 1 * gx[48]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[336] - 1 * gx[48]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1760] - 1 * gx[1728]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1824] - 1 * gx[1728]) * prod_xz;
                    v_lyy += al2 * (al2 * (gx[2304] - gx[2160] * ylyk) - 3 * gx[1728]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v_izz += ai2 * (ai2 * (gx[2816] + gx[2768] * zjzi) - 3 * gx[2752]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[2848] - 1 * gx[2752]) * prod_xy;
                    v_lzz += al2 * (al2 * gx[3616] - 1 * gx[2752]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3328] + gx[2896] * zlzk) - 3 * gx[2752]) * prod_xy;
                    v1xx += (aj2 * ai2 * gx[112] - 1 * ai2 * gx[16]) * prod_yz;
                    v2xx += al2 * ak2 * gx[624] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1792] * prod_xz;
                    v2yy += (al2 * ak2 * gx[2304] - 1 * ak2 * gx[1440]) * prod_xz;
                    v1zz += aj2 * (ai2 * gx[2816] - 1 * gx[2784]) * prod_xy;
                    v2zz += al2 * (ak2 * gx[3328] - 1 * gx[3040]) * prod_xy;
                    dd = dd_cache[1008];
                    Ix = gx[64];
                    Iy = gx[1440];
                    Iz = gx[3024];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[112] - 1 * gx[16];
                    f2x = ai2 * gx[80] - 1 * gx[48];
                    f1y = aj2 * gx[1488];
                    f2y = ai2 * gx[1456];
                    f1z = aj2 * gx[3072];
                    f2z = ai2 * gx[3040];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[496];
                    f2x = ak2 * gx[208];
                    f1y = al2 * gx[1872];
                    f2y = ak2 * gx[1584] - 1 * gx[1296];
                    f1z = al2 * gx[3456] - 1 * gx[2592];
                    f2z = ak2 * gx[3168];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * (gx[128] + gx[80] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_jxx += aj2 * (aj2 * (gx[128] - gx[112] * xjxi) - 3 * gx[64]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[928] - 1 * gx[64]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[352] - 1 * gx[64]) * prod_yz;
                    v_iyy += ai2 * (ai2 * gx[1472] - 1 * gx[1440]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1536] - 1 * gx[1440]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2304] - 1 * gx[1440]) * prod_xz;
                    v_kyy += ak2 * (ak2 * (gx[2016] + gx[1584] * ylyk) - 3 * gx[1440]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3056] - 1 * gx[3024]) * prod_xy;
                    v_jzz += aj2 * (aj2 * gx[3120] - 1 * gx[3024]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3600] - gx[3456] * zlzk) - 3 * gx[3024]) * prod_xy;
                    v_kzz += ak2 * (ak2 * gx[3312] - 1 * gx[3024]) * prod_xy;
                    v1xx += (aj2 * (ai2 * gx[128] - 1 * gx[96]) - 1 * (ai2 * gx[32] - 1 * gx[0])) * prod_yz;
                    v2xx += al2 * ak2 * gx[640] * prod_yz;
                    v1yy += aj2 * ai2 * gx[1504] * prod_xz;
                    v2yy += al2 * (ak2 * gx[2016] - 1 * gx[1728]) * prod_xz;
                    v1zz += aj2 * ai2 * gx[3088] * prod_xy;
                    v2zz += (al2 * ak2 * gx[3600] - 1 * ak2 * gx[2736]) * prod_xy;
                    dd = dd_cache[1264];
                    Ix = gx[0];
                    Iy = gx[1312];
                    Iz = gx[3216];
                    Ixdd = Ix * dd;
                    Iydd = Iy * dd;
                    Izdd = Iz * dd;
                    f1x = aj2 * gx[48];
                    f2x = ai2 * gx[16];
                    f1y = aj2 * gx[1360];
                    f2y = ai2 * gx[1328] - 1 * gx[1296];
                    f1z = aj2 * gx[3264] - 1 * gx[3168];
                    f2z = ai2 * gx[3232];
                    v_ixy += f2x * f2y * Izdd;
                    v_ixz += f2x * f2z * Iydd;
                    v_iyz += f2y * f2z * Ixdd;
                    v_jxy += f1x * f1y * Izdd;
                    v_jxz += f1x * f1z * Iydd;
                    v_jyz += f1y * f1z * Ixdd;
                    v1xy += f2x * f1y * Izdd;
                    v1xz += f2x * f1z * Iydd;
                    v1yx += f2y * f1x * Izdd;
                    v1yz += f2y * f1z * Ixdd;
                    v1zx += f2z * f1x * Iydd;
                    v1zy += f2z * f1y * Ixdd;
                    f1x = al2 * gx[432];
                    f2x = ak2 * gx[144];
                    f1y = al2 * gx[1744];
                    f2y = ak2 * gx[1456];
                    f1z = al2 * gx[3648] - 1 * gx[2784];
                    f2z = ak2 * gx[3360] - 1 * gx[3072];
                    v_kxy += f2x * f2y * Izdd;
                    v_kxz += f2x * f2z * Iydd;
                    v_kyz += f2y * f2z * Ixdd;
                    v_lxy += f1x * f1y * Izdd;
                    v_lxz += f1x * f1z * Iydd;
                    v_lyz += f1y * f1z * Ixdd;
                    v2xy += f2x * f1y * Izdd;
                    v2xz += f2x * f1z * Iydd;
                    v2yx += f2y * f1x * Izdd;
                    v2yz += f2y * f1z * Ixdd;
                    v2zx += f2z * f1x * Iydd;
                    v2zy += f2z * f1y * Ixdd;
                    prod_xy = Ix * Iy * dd;
                    prod_xz = Ix * Iz * dd;
                    prod_yz = Iy * Iz * dd;
                    v_ixx += ai2 * (ai2 * gx[32] - 1 * gx[0]) * prod_yz;
                    v_jxx += aj2 * (aj2 * gx[96] - 1 * gx[0]) * prod_yz;
                    v_lxx += al2 * (al2 * gx[864] - 1 * gx[0]) * prod_yz;
                    v_kxx += ak2 * (ak2 * gx[288] - 1 * gx[0]) * prod_yz;
                    v_iyy += ai2 * (ai2 * (gx[1376] + gx[1328] * yjyi) - 3 * gx[1312]) * prod_xz;
                    v_jyy += aj2 * (aj2 * gx[1408] - 1 * gx[1312]) * prod_xz;
                    v_lyy += al2 * (al2 * gx[2176] - 1 * gx[1312]) * prod_xz;
                    v_kyy += ak2 * (ak2 * gx[1600] - 1 * gx[1312]) * prod_xz;
                    v_izz += ai2 * (ai2 * gx[3248] - 1 * gx[3216]) * prod_xy;
                    v_jzz += aj2 * (aj2 * (gx[3280] - gx[3264] * zjzi) - 3 * gx[3216]) * prod_xy;
                    v_lzz += al2 * (al2 * (gx[3792] - gx[3648] * zlzk) - 3 * gx[3216]) * prod_xy;
                    v_kzz += ak2 * (ak2 * (gx[3792] + gx[3360] * zlzk) - 3 * gx[3216]) * prod_xy;
                    v1xx += aj2 * ai2 * gx[64] * prod_yz;
                    v2xx += al2 * ak2 * gx[576] * prod_yz;
                    v1yy += aj2 * (ai2 * gx[1376] - 1 * gx[1344]) * prod_xz;
                    v2yy += al2 * ak2 * gx[1888] * prod_xz;
                    v1zz += (aj2 * ai2 * gx[3280] - 1 * ai2 * gx[3184]) * prod_xy;
                    v2zz += (al2 * (ak2 * gx[3792] - 1 * gx[3504]) - 1 * (ak2 * gx[2928] - 1 * gx[2640])) * prod_xy;
                    break;
                    }
                }
            }
        }
        if (task_id >= ntasks) {
            continue;
        }
        int ia = bas[ish*BAS_SLOTS+ATOM_OF];
        int ja = bas[jsh*BAS_SLOTS+ATOM_OF];
        int ka = bas[ksh*BAS_SLOTS+ATOM_OF];
        int la = bas[lsh*BAS_SLOTS+ATOM_OF];
        int natm = envs.natm;
        double *ejk = jk.ejk;
        atomicAdd(ejk + (ia*natm+ja)*9 + 0, v1xx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 1, v1xy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 2, v1xz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 3, v1yx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 4, v1yy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 5, v1yz);
        atomicAdd(ejk + (ia*natm+ja)*9 + 6, v1zx);
        atomicAdd(ejk + (ia*natm+ja)*9 + 7, v1zy);
        atomicAdd(ejk + (ia*natm+ja)*9 + 8, v1zz);
        atomicAdd(ejk + (ka*natm+la)*9 + 0, v2xx);
        atomicAdd(ejk + (ka*natm+la)*9 + 1, v2xy);
        atomicAdd(ejk + (ka*natm+la)*9 + 2, v2xz);
        atomicAdd(ejk + (ka*natm+la)*9 + 3, v2yx);
        atomicAdd(ejk + (ka*natm+la)*9 + 4, v2yy);
        atomicAdd(ejk + (ka*natm+la)*9 + 5, v2yz);
        atomicAdd(ejk + (ka*natm+la)*9 + 6, v2zx);
        atomicAdd(ejk + (ka*natm+la)*9 + 7, v2zy);
        atomicAdd(ejk + (ka*natm+la)*9 + 8, v2zz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 0, v_ixx*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 3, v_ixy);
        atomicAdd(ejk + (ia*natm+ia)*9 + 4, v_iyy*.5);
        atomicAdd(ejk + (ia*natm+ia)*9 + 6, v_ixz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 7, v_iyz);
        atomicAdd(ejk + (ia*natm+ia)*9 + 8, v_izz*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 0, v_jxx*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 3, v_jxy);
        atomicAdd(ejk + (ja*natm+ja)*9 + 4, v_jyy*.5);
        atomicAdd(ejk + (ja*natm+ja)*9 + 6, v_jxz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 7, v_jyz);
        atomicAdd(ejk + (ja*natm+ja)*9 + 8, v_jzz*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 0, v_kxx*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 3, v_kxy);
        atomicAdd(ejk + (ka*natm+ka)*9 + 4, v_kyy*.5);
        atomicAdd(ejk + (ka*natm+ka)*9 + 6, v_kxz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 7, v_kyz);
        atomicAdd(ejk + (ka*natm+ka)*9 + 8, v_kzz*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 0, v_lxx*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 3, v_lxy);
        atomicAdd(ejk + (la*natm+la)*9 + 4, v_lyy*.5);
        atomicAdd(ejk + (la*natm+la)*9 + 6, v_lxz);
        atomicAdd(ejk + (la*natm+la)*9 + 7, v_lyz);
        atomicAdd(ejk + (la*natm+la)*9 + 8, v_lzz*.5);
    }
    if (thread_id == 0) {
        pair_ij = atomicAdd(head, 1);
    }
    __syncthreads();
}
}

int rys_ejk_ip2_type12_unrolled(RysIntEnvVars *envs, JKEnergy *jk, BoundsInfo *bounds,
                        int *pool, double *dd_pool)
{
    int li = bounds->li;
    int lj = bounds->lj;
    int lk = bounds->lk;
    int ll = bounds->ll;
    int ijkl = li*125 + lj*25 + lk*5 + ll;
    int nroots = bounds->nroots;
    int nsq_per_block = 256;
    int gout_stride = 1;

    switch (ijkl) {
    case 131:
        nsq_per_block = 32;
        gout_stride = 8;
        break;
    case 155:
        nsq_per_block = 32;
        gout_stride = 8;
        break;
    case 156:
        nsq_per_block = 16;
        gout_stride = 16;
        break;
    }

    cudaDeviceProp prop;
    cudaGetDeviceProperties(&prop, 0);
    int workers = prop.multiProcessorCount;
    int *head = pool + workers * QUEUE_DEPTH;
    cudaMemset(head, 0, sizeof(int));

    dim3 threads(nsq_per_block, gout_stride);
    int iprim = bounds->iprim;
    int jprim = bounds->jprim;
    int buflen = nroots*2 * nsq_per_block + iprim*jprim;
    switch (ijkl) {
    case 0:
        rys_ejk_ip2_type12_0000<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 125:
        rys_ejk_ip2_type12_1000<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 130:
        rys_ejk_ip2_type12_1010<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 131:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type12_1011, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type12_1011<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 150:
        rys_ejk_ip2_type12_1100<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 155:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type12_1110, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type12_1110<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    case 156:
        buflen += (bounds->g_size * 3 + 9) * nsq_per_block;
        cudaFuncSetAttribute(rys_ejk_ip2_type12_1111, cudaFuncAttributeMaxDynamicSharedMemorySize, buflen*sizeof(double));
        rys_ejk_ip2_type12_1111<<<workers, threads, buflen*sizeof(double)>>>(*envs, *jk, *bounds, pool, dd_pool, head); break;
    default: return 0;
    }
    return 1;
}
